class FormsStepsProgressBarBlock in Forms Steps 8
Same name in this branch
- 8 src/Plugin/Derivative/FormsStepsProgressBarBlock.php \Drupal\forms_steps\Plugin\Derivative\FormsStepsProgressBarBlock
- 8 src/Plugin/Block/FormsStepsProgressBarBlock.php \Drupal\forms_steps\Plugin\Block\FormsStepsProgressBarBlock
Provides block plugin definitions for progress bars.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\forms_steps\Plugin\Derivative\FormsStepsProgressBarBlock implements ContainerDeriverInterface
Expanded class hierarchy of FormsStepsProgressBarBlock
See also
\Drupal\forms_steps\Plugin\Block\FormsStepsProgressBarBlock
File
- src/
Plugin/ Derivative/ FormsStepsProgressBarBlock.php, line 15
Namespace
Drupal\forms_steps\Plugin\DerivativeView source
class FormsStepsProgressBarBlock extends DeriverBase implements ContainerDeriverInterface {
/**
* The forms steps storage.
*
* @var \Drupal\Core\Entity\EntityStorageInterface
*/
protected $formStepsStorage;
/**
* Constructs new forms steps progress bar block.
*
* @param \Drupal\Core\Entity\EntityStorageInterface $forms_steps_storage
* The forms steps storage.
*/
public function __construct(EntityStorageInterface $forms_steps_storage) {
$this->formStepsStorage = $forms_steps_storage;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('entity_type.manager')
->getStorage('forms_steps'));
}
/**
* {@inheritdoc}
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
FormsStepsProgressBarBlock:: |
protected | property | The forms steps storage. | |
FormsStepsProgressBarBlock:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
FormsStepsProgressBarBlock:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
FormsStepsProgressBarBlock:: |
public | function | Constructs new forms steps progress bar block. |