original_string: protected function _setRegions($block = null)
      {
          $regions = plugin()
              ->filter(function ($plugin) {
                  return $plugin->isTheme;
              })
              ->map(function ($theme) use ($block) {
                  $value = '';
                  if ($block !== null && $block->has('region')) {
                      foreach ($block->region as $blockRegion) {
                          if ($blockRegion->theme == $theme->name) {
                              $value = $blockRegion->region;
                              break;
                          }
                      }
                  }
  
                  return [
                      'theme_machine_name' => $theme->name,
                      'theme_human_name' => $theme->humanName,
                      'description' => $theme->composer['description'],
                      'regions' => (array)$theme->composer['extra']['regions'],
                      'value' => $value,
                  ];
              });
          $this->set('regions', $regions);
      }
code: protected function _setRegions($block = null)
      {
          $regions = plugin()
              ->filter(function ($plugin) {
                  return $plugin->isTheme;
              })
              ->map(function ($theme) use ($block) {
                  $value = '';
                  if ($block !== null && $block->has('region')) {
                      foreach ($block->region as $blockRegion) {
                          if ($blockRegion->theme == $theme->name) {
                              $value = $blockRegion->region;
                              break;
                          }
                      }
                  }
  
                  return [
                      'theme_machine_name' => $theme->name,
                      'theme_human_name' => $theme->humanName,
                      'description' => $theme->composer['description'],
                      'regions' => (array)$theme->composer['extra']['regions'],
                      'value' => $value,
                  ];
              });
          $this->set('regions', $regions);
      }
code_tokens: protected function _setRegions ( $ block = null ) { $ regions = plugin ( ) -> filter ( function ( $ plugin ) { return $ plugin -> isTheme ; } ) -> map ( function ( $ theme ) use ( $ block ) { $ value = '' ; if ( $ block !== null && $ block -> has ( 'region' ) ) { foreach ( $ block -> region as $ blockRegion ) { if ( $ blockRegion -> theme == $ theme -> name ) { $ value = $ blockRegion -> region ; break ; } } } return [ 'theme_machine_name' => $ theme -> name , 'theme_human_name' => $ theme -> humanName , 'description' => $ theme -> composer [ 'description' ] , 'regions' => ( array ) $ theme -> composer [ 'extra' ] [ 'regions' ] , 'value' => $ value , ] ; } ) ; $ this -> set ( 'regions' , $ regions ) ; }
docstring: Sets "regions" variable for later use in FormHelper.
  
  This variable is used to properly fill inputs in the "Theme Region"
  section of the add/edit form.
  
  @param null|\Block\Model\Entity\Block $block If a block entity is provided it
  will be used to guess which regions has been already selected in each theme,
  so we can properly show the selectbox in the form with the corrects
  options selected.
  @return void
docstring_tokens: Sets regions variable for later use in FormHelper .