You are here

protected function ScriptForm::getEnabledVisibilityDefinitions in Script Manager 8

Get the enabled visibility plugin definitions.

1 call to ScriptForm::getEnabledVisibilityDefinitions()
ScriptForm::buildVisibilityForm in src/Form/ScriptForm.php
Build the visibility form.

File

src/Form/ScriptForm.php, line 161

Class

ScriptForm
The script entity add form.

Namespace

Drupal\script_manager\Form

Code

protected function getEnabledVisibilityDefinitions() {
  $definitions = $this->conditionManager
    ->getFilteredDefinitions('script_manager');
  $enabled_plugins = $this->configuration
    ->get('enabled_visibility_plugins');
  return $enabled_plugins ? array_filter($definitions, function ($definition) use ($enabled_plugins) {
    return in_array($definition['id'], $enabled_plugins);
  }) : $definitions;
}