You are here

public function IncludeExcludeStyleTrait::allowStyles in Block Style Plugins 8.2

Determine whether a style should be allowed.

Parameters

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

array $plugin_definition: A list of definitions for a block_style_plugin which could have 'include' or 'exclude' as keys.

Return value

bool Return True if the block should show the styles.

3 calls to IncludeExcludeStyleTrait::allowStyles()
BlockFormAlter::alterForm in src/BlockFormAlter.php
Alter a form and set block configuration.
BlockStyleForm::buildForm in src/Form/BlockStyleForm.php
Form constructor.
SectionFormAlter::alterForm in src/SectionFormAlter.php
Alter a form and set Layout Builder Section configuration.

File

src/IncludeExcludeStyleTrait.php, line 22

Class

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

Namespace

Drupal\block_style_plugins

Code

public function allowStyles($plugin_id, array $plugin_definition) {
  if ($this
    ->includeOnly($plugin_id, $plugin_definition) && !$this
    ->exclude($plugin_id, $plugin_definition)) {
    return TRUE;
  }
  return FALSE;
}