You are here

function metatag_is_current_route_supported in Metatag 8

Identify whether the current route is supported by the module.

Return value

bool TRUE if the current route is supported.

4 calls to metatag_is_current_route_supported()
metatag_open_graph_preprocess_html in metatag_open_graph/metatag_open_graph.module
Implements template_preprocess_html().
metatag_page_attachments in ./metatag.module
Implements hook_page_attachments().
metatag_preprocess_html in ./metatag.module
Implements template_preprocess_html().
metatag_tokens in ./metatag.tokens.inc
Implements hook_tokens().

File

./metatag.module, line 325
Contains metatag.module.

Code

function metatag_is_current_route_supported() {

  // If upgrading, we need to wait for database updates to complete.
  $is_ready = \Drupal::service('entity_type.manager')
    ->getDefinition('metatag_defaults', FALSE);
  if (!$is_ready) {
    return FALSE;
  }

  // Ignore admin paths.
  if (\Drupal::service('router.admin_context')
    ->isAdminRoute()) {
    return FALSE;
  }

  // Skip everything if the site is in maintenance mode.
  $route_match = \Drupal::routeMatch();
  if (\Drupal::service('maintenance_mode')
    ->applies($route_match)) {
    return FALSE;
  }
  return TRUE;
}