You are here

public function IncludeExcludeStyleTrait::exclude in Block Style Plugins 8.2

Exclude styles from appearing on blocks.

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

Parameters

string $plugin_id: The ID of the block being checked.

array $plugin_definition: A list of definitions for a block_style_plugins which could have the key 'exclude' set as a list of block plugin ids to disallow.

Return value

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

1 call to IncludeExcludeStyleTrait::exclude()
IncludeExcludeStyleTrait::allowStyles in src/IncludeExcludeStyleTrait.php
Determine whether a style should be allowed.

File

src/IncludeExcludeStyleTrait.php, line 45

Class

IncludeExcludeStyleTrait
Provides a helper for determining whether to include or exclude a plugin.

Namespace

Drupal\block_style_plugins

Code

public function exclude($plugin_id, array $plugin_definition) {
  $list = [];
  if (isset($plugin_definition['exclude'])) {
    $list = $plugin_definition['exclude'];
  }
  if (!empty($list) && $this
    ->matchPattern($plugin_id, $list)) {
    return TRUE;
  }
  return FALSE;
}