You are here

protected function BlockStyleBase::baseIdMatch in Block Style Plugins 8

Determine if a plugin ID matches a Base ID in a list of include/exclude.

Parameters

string $plugin_id: Plugin ID of a block.

array $list: List of include/exclude blocks.

Return value

bool True if a plugin matches a base ID.

2 calls to BlockStyleBase::baseIdMatch()
BlockStyleBase::exclude in src/Plugin/BlockStyleBase.php
Exclude styles from appearing on a block.
BlockStyleBase::includeOnly in src/Plugin/BlockStyleBase.php
Only show styles on specific blocks.

File

src/Plugin/BlockStyleBase.php, line 364

Class

BlockStyleBase
Base class for Block style plugins.

Namespace

Drupal\block_style_plugins\Plugin

Code

protected function baseIdMatch($plugin_id, array $list) {

  // Now check to see if this ID is a derivative on something in the list.
  preg_match('/^([^:]+):?/', $plugin_id, $matches);
  if ($matches && in_array($matches[1] . ':*', $list)) {
    return TRUE;
  }
  return FALSE;
}