/**
 * Checks if a metatag configuration record is enabled.
 *
 * @param string $instance
 *   The configuration instance machine name.
 *
 * @return bool
 *   TRUE if the configuration is enabled, or FALSE otherwise.
 */
function metatag_config_is_enabled($instance, $include_defaults = FALSE, $include_global = TRUE) {
  if ($include_defaults) {  
    return (bool) metatag_config_load_with_defaults($instance, $include_global);
  }
  else {
    $config = metatag_config_load($instance);
    return !empty($config) && empty($config->disabled);
  }
}

This returns TRUE or FALSE


/**
 * Check if an individual entity has meta tags defined, or has defaults.
 *
 * @param string $entity_type
 *   An entity type.
 * @param object $entity
 *   An entity object.
 *
 * @return boolean
 *   TRUE or FALSE if the entity should have a form for or process meta tags.
 */
function metatag_entity_has_metatags($entity_type, $entity) {
  ...
  if (!isset($config_exists[$instance])) {
   // This is set to TRUE or false
    $config_exists[$instance] = metatag_config_is_enabled($instance, TRUE, FALSE);
  }

  return isset($config_exists[$instance]);
}

TRUE or FALSE are valid set values (unlike null), so it returns TRUE despite the entity config being disabled

Steps to reproduce
1) install metatags
2) disable user entity
3) view user form
4) see mega tag fieldset

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hefox’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
391 bytes
DamienMcKenna’s picture

Issue summary: View changes
Status: Needs review » Fixed

Thanks for the patch. Committed!

DamienMcKenna’s picture

@hefox: I just realized I forgot to give you proper attribution for the commit, sorry :( You are mentioned in the changelog, you just aren't the --author of the commit.

In other news, I keep forgetting to do that :(

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.