You are here

public function WebformOptionsCustomDeriverBase::getDerivativeDefinitions in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_options_custom/src/Plugin/Derivative/WebformOptionsCustomDeriverBase.php \Drupal\webform_options_custom\Plugin\Derivative\WebformOptionsCustomDeriverBase::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

modules/webform_options_custom/src/Plugin/Derivative/WebformOptionsCustomDeriverBase.php, line 49

Class

WebformOptionsCustomDeriverBase
Provides base class for webform custom options derivers.

Namespace

Drupal\webform_options_custom\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $webform_options_custom_entities = $this
    ->getEntityStorage('webform_options_custom')
    ->loadMultiple();
  foreach ($webform_options_custom_entities as $webform_options_custom_entity) {
    if ($webform_options_custom_entity
      ->get($this->type)) {
      $this->derivatives[$webform_options_custom_entity
        ->id()] = $base_plugin_definition;
      $this->derivatives[$webform_options_custom_entity
        ->id()]['label'] = $webform_options_custom_entity
        ->label() . ($this->type === 'entity_reference' ? ' ' . $this
        ->t('(Entity reference)') : '');
      $this->derivatives[$webform_options_custom_entity
        ->id()]['description'] = $webform_options_custom_entity
        ->get('description');
    }
  }
  return $this->derivatives;
}