You are here

protected function ShareMessageViewBuilder::mapHeadElements in Share Message 8

Modifies a buildOGTags structure to work with drupal_add_html_head.

Parameters

array $elements: An array containing the Open Graph meta tags:

  • title
  • image: If at least one image Url is given.
  • video, video:width, video:height, video:type: If at least one video Url is given.
  • url
  • description
  • type

Return value

array $mapped The new structured buildOGTags array to work with drupal_add_html_head.

1 call to ShareMessageViewBuilder::mapHeadElements()
ShareMessageViewBuilder::viewMultiple in src/Entity/Handler/ShareMessageViewBuilder.php
Builds the render array for the provided entities.

File

src/Entity/Handler/ShareMessageViewBuilder.php, line 91

Class

ShareMessageViewBuilder
Render controller for nodes.

Namespace

Drupal\sharemessage\Entity\Handler

Code

protected function mapHeadElements(array $elements) {
  $mapped = [];
  foreach ($elements as $element) {
    $mapped[] = [
      $element,
      str_replace(':', '_', $element['#attributes']['property']),
    ];
  }
  return $mapped;
}