You are here

public function YoastSeoManager::setTargetsConfiguration in Real-time SEO for Drupal 8

Set configuration for js target elements.

Parameters

array $elt: The element on which to attach the configuration.

Return value

array The same element passed, with the new configuration attached.

File

src/YoastSeoManager.php, line 203

Class

YoastSeoManager
Class YoastSeoManager.

Namespace

Drupal\yoast_seo

Code

public function setTargetsConfiguration(&$elt) {
  foreach (self::$jsTargets as $js_target_name => $js_target_id) {
    $elt['#attached']['drupalSettings']['yoast_seo']['targets'][$js_target_name] = $js_target_id;
  }
  return $elt;
}