You are here

class BlockUploadBlock in Block Upload 8

Same name in this branch
  1. 8 src/Plugin/Derivative/BlockUploadBlock.php \Drupal\block_upload\Plugin\Derivative\BlockUploadBlock
  2. 8 src/Plugin/Block/BlockUploadBlock.php \Drupal\block_upload\Plugin\Block\BlockUploadBlock

Provides block plugin definitions for mymodule blocks.

Hierarchy

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\Derivative
View 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

Namesort descending Modifiers Type Description Overrides
BlockUploadBlock::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition