You are here

public function ThunderMetaTagTrait::generateMetaTagFieldValues in Thunder 6.1.x

Same name and namespace in other branches
  1. 8.5 tests/src/FunctionalJavascript/ThunderMetaTagTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMetaTagTrait::generateMetaTagFieldValues()
  2. 8.2 tests/src/FunctionalJavascript/ThunderMetaTagTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMetaTagTrait::generateMetaTagFieldValues()
  3. 8.3 tests/src/FunctionalJavascript/ThunderMetaTagTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMetaTagTrait::generateMetaTagFieldValues()
  4. 8.4 tests/src/FunctionalJavascript/ThunderMetaTagTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMetaTagTrait::generateMetaTagFieldValues()
  5. 6.2.x tests/src/FunctionalJavascript/ThunderMetaTagTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMetaTagTrait::generateMetaTagFieldValues()
  6. 6.0.x tests/src/FunctionalJavascript/ThunderMetaTagTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMetaTagTrait::generateMetaTagFieldValues()

Generate field name and field value mappings for meta tag configuration.

Parameters

array $configuration: Meta tag configuration.

string $fieldNamePrefix: Field name prefix (fe. field_meta_tags[0])

Return value

array List with field names and values for it.

3 calls to ThunderMetaTagTrait::generateMetaTagFieldValues()
MetaInformationTest::setMetaTagConfigurationForUrl in tests/src/FunctionalJavascript/MetaInformationTest.php
Set meta tag configuration for administration url.
MetaInformationTest::testArticleMetaTags in tests/src/FunctionalJavascript/MetaInformationTest.php
Test Meta Tag default configuration and custom configuration for article.
ModuleIntegrationTest::testFacebookMetaTags in tests/src/FunctionalJavascript/ModuleIntegrationTest.php
Testing integration of "metatag_facebook" module.

File

tests/src/FunctionalJavascript/ThunderMetaTagTrait.php, line 114

Class

ThunderMetaTagTrait
Trait for manipulation of meta tag configuration and meta tags on page.

Namespace

Drupal\Tests\thunder\FunctionalJavascript

Code

public function generateMetaTagFieldValues(array $configuration, $fieldNamePrefix = '') {
  $fieldValues = [];
  foreach ($configuration as $metaTagName => $metaTagValue) {
    $metaTag = explode(' ', $metaTagName);
    if (!empty($fieldNamePrefix)) {
      $fieldValues[$this
        ->getMetaTagFieldName($metaTag[1], $metaTag[0], $fieldNamePrefix)] = $metaTagValue;
    }
    else {
      $fieldValues[$this
        ->getMetaTagFieldName($metaTag[1])] = $metaTagValue;
    }
  }
  return $fieldValues;
}