5 * Contains metatag_open_graph.module.
9 * Implements template_preprocess_html().
11 function metatag_open_graph_preprocess_html(&$variables) {
12 if (!metatag_is_current_route_supported()) {
16 // Add XML namespaces if the RDF module is not enabled as it adds these two
18 if (!isset($variables['html_attributes'])) {
19 $variables['html_attributes'] = [];
22 if (!\Drupal::moduleHandler()->moduleExists('rdf')) {
24 'prefix' => 'og: http://ogp.me/ns#',
28 // Namespaces for Google+.
29 if (isset($variables['itemtype'])) {
30 $namespaces['itemscope'] = '';
31 $namespaces['itemtype'] = "http://schema.org/{$variables['itemtype']}";
34 // Append each namespace.
35 foreach ($namespaces as $namespace => $uri) {
36 $variables['html_attributes'][$namespace] = $uri;