class BlockUploadBlock in Block Upload 8
Same name in this branch
- 8 src/Plugin/Derivative/BlockUploadBlock.php \Drupal\block_upload\Plugin\Derivative\BlockUploadBlock
- 8 src/Plugin/Block/BlockUploadBlock.php \Drupal\block_upload\Plugin\Block\BlockUploadBlock
Provides block plugin definitions for mymodule blocks.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\block_upload\Plugin\Derivative\BlockUploadBlock
Expanded class hierarchy of BlockUploadBlock
See also
\Drupal\block_upload\Plugin\Block\BlockUploadBlock
File
- src/
Plugin/ Derivative/ BlockUploadBlock.php, line 13
Namespace
Drupal\block_upload\Plugin\DerivativeView source
class BlockUploadBlock extends DeriverBase {
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$blocks_count = \Drupal::state()
->get('block_upload_count');
for ($i = 1; $i <= $blocks_count; $i++) {
$this->derivatives['block_upload' . $i] = $base_plugin_definition;
$this->derivatives['block_upload' . $i]['admin_label'] = 'Block upload ' . $i;
$this->derivatives['block_upload' . $i]['cache'] = [
'max_age' => 0,
];
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BlockUploadBlock:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |