You are here

public function MetatagViewsValuesCleanerTrait::clearMetatagViewsDisallowedValues in Metatag 8

Clears the metatag form state values from illegal elements.

Parameters

array $metatags: Array of values to submit.

Return value

array Filtered metatag array.

2 calls to MetatagViewsValuesCleanerTrait::clearMetatagViewsDisallowedValues()
MetatagViewsEditForm::submitForm in metatag_views/src/Form/MetatagViewsEditForm.php
Form submission handler.
MetatagViewsTranslationForm::form in metatag_views/src/Form/MetatagViewsTranslationForm.php
Add the translation form element for meta tags available in the source.

File

metatag_views/src/MetatagViewsValuesCleanerTrait.php, line 19

Class

MetatagViewsValuesCleanerTrait
Collection of helper methods when handling raw tag values.

Namespace

Drupal\metatag_views

Code

public function clearMetatagViewsDisallowedValues(array $metatags) {

  // Get all legal tags.
  $tags = $this->metatagManager
    ->sortedTags();

  // Return only common elements.
  $metatags = array_intersect_key($metatags, $tags);
  return $metatags;
}