You are here

public static function MetatagViewsController::getTaggedViews in Metatag 8

Get meta tags for all of the views / displays that have them set.

Return value

array List of tags grouped by view and display.

2 calls to MetatagViewsController::getTaggedViews()
MetatagViewsAddForm::buildForm in metatag_views/src/Form/MetatagViewsAddForm.php
Form constructor.
MetatagViewsController::listViews in metatag_views/src/Controller/MetatagViewsController.php
Generates the renderable array for views meta tags UI.

File

metatag_views/src/Controller/MetatagViewsController.php, line 67

Class

MetatagViewsController
Class MetatagViewsController.

Namespace

Drupal\metatag_views\Controller

Code

public static function getTaggedViews() {
  $tagged_views = [];
  foreach (Views::getEnabledViews() as $view_id => $view) {
    $displays = $view
      ->get('display');
    foreach (array_keys($displays) as $display_id) {
      if ($tags = metatag_get_view_tags($view_id, $display_id)) {
        $tagged_views[$view_id][$display_id] = $tags;
      }
    }
  }
  return $tagged_views;
}