You are here

public function BlockStyleBase::includeOnly in Block Style Plugins 8

Only show styles on specific blocks.

Determine if configuration should be only included on certain blocks when a block plugin id or block content type is passed from a plugin.

Return value

bool Return True if the current block should only get the styles.

Overrides BlockStyleInterface::includeOnly

1 call to BlockStyleBase::includeOnly()
BlockStyleBase::prepareForm in src/Plugin/BlockStyleBase.php
Returns the configuration form elements specific to a block configuration.

File

src/Plugin/BlockStyleBase.php, line 338

Class

BlockStyleBase
Base class for Block style plugins.

Namespace

Drupal\block_style_plugins\Plugin

Code

public function includeOnly() {
  $list = [];
  if (isset($this->pluginDefinition['include'])) {
    $list = $this->pluginDefinition['include'];
  }
  $block_plugin_id = $this->blockPlugin
    ->getPluginId();
  if (empty($list) || (in_array($block_plugin_id, $list) || $this
    ->baseIdMatch($block_plugin_id, $list) || in_array($this->blockContentBundle, $list))) {
    return TRUE;
  }
  return FALSE;
}