You are here

public function TaxonomyTooltip::setConfiguration in Glossify 8

Sets the configuration for this plugin instance.

Parameters

array $configuration: An associative array containing the plugin's configuration.

Overrides FilterBase::setConfiguration

File

modules/glossify_taxonomy/src/Plugin/Filter/TaxonomyTooltip.php, line 163

Class

TaxonomyTooltip
Filter to find and process found taxonomy terms in the fields value.

Namespace

Drupal\glossify_taxonomy\Plugin\Filter

Code

public function setConfiguration(array $configuration) {
  if (isset($configuration['status'])) {
    $this->status = (bool) $configuration['status'];
  }
  if (isset($configuration['weight'])) {
    $this->weight = (int) $configuration['weight'];
  }
  if (isset($configuration['settings'])) {

    // Workaround for not accepting arrays in config schema.
    if (is_array($configuration['settings']['glossify_taxonomy_vocabs'])) {
      $glossify_taxonomy_vocabs = array_filter($configuration['settings']['glossify_taxonomy_vocabs']);
      $configuration['settings']['glossify_taxonomy_vocabs'] = implode(';', $glossify_taxonomy_vocabs);
    }
    $this->settings = (array) $configuration['settings'];
  }
  return $this;
}