You are here

public function FormsStepsProgressBarBlock::getDerivativeDefinitions in Forms Steps 8

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

src/Plugin/Derivative/FormsStepsProgressBarBlock.php, line 46

Class

FormsStepsProgressBarBlock
Provides block plugin definitions for progress bars.

Namespace

Drupal\forms_steps\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {

  // Load all available forms steps.
  $forms_steps_entities = $this->formStepsStorage
    ->loadMultiple();
  foreach ($forms_steps_entities as $forms_steps) {
    $progress_steps = $forms_steps
      ->getProgressSteps();
    if (count($progress_steps)) {
      $this->derivatives[$forms_steps
        ->id()] = $base_plugin_definition;
      $this->derivatives[$forms_steps
        ->id()]['admin_label'] = t('Forms Steps - :title (Progress bar)', [
        ':title' => $forms_steps
          ->label(),
      ]);
    }
  }
  return $this->derivatives;
}