Problem/Motivation

Administrators can no longer disable the meta tag form on the admin page.

Steps to reproduce

  1. Download and enable the beta5 release of the metatag module.
  2. Browse to /admin/people/create and observe the meta tags fieldset at the bottom of the form.
  3. Browse to /admin/config/search/metatags and disable the User configuration.
  4. Clear all caches
  5. Browse to /admin/people/create and observe the meta tags fieldset is still at the bottom of the form.

Proposed resolution

It appears that a new function (metatag_config_is_enabled) was introduced between beta4 and beta5 in commit: 140a3243d60a1935a2776df6ac459c1dbb713494 and the metatag_entity_has_metatags function was refactored to use the new function. However, the return function was not updated to handle the response from the new function.

Remaining tasks

  1. Create a patch to update the return statement
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

douglasmiller’s picture

Status: Active » Needs review
FileSize
381 bytes

Attached patch

DamienMcKenna’s picture

Status: Needs review » Closed (duplicate)

This is working from an incorrect assumption that a site maintainer wouldn't want the meta tag fields to show, even if there wasn't a configuration specifically for that entity type. Instead, what you're looking for is this: #1286270: Option to disable meta tags per entity/bundle/object

douglasmiller’s picture

I must be interpreting the configuration page incorrectly. I was operating on the assumption that disabling the User configuration would disable metatags for the User entity. I have done some testing with the 7.x-1.x branch and have observed that my assumptions are wrong.

Here are the steps that I performed to verify using the HEAD of the 7.x-1.x branch:

  1. Perform a clean install of Drupal.
  2. Download and enable the metatag module and it's dependencies.
  3. Override the Global configuration and add 'global' to the description at /admin/config/search/metatags/config/global.
  4. Override the User configuration and add 'user' to the description at /admin/config/search/metatags/config/user.
  5. Browse to: /admin/people/create and expand the Meta Tags fieldset and observe that the description is pre-populated to 'user'.
  6. Browse to: /user/1 and view the source and observe that the description meta tag is outputs 'user'.
  7. Disable the User configuration at /admin/config/search/metatags/ then clear all caches.
  8. Browse to: /admin/people/create and expand the Meta Tags fieldset and observe that the description is now pre-populated to 'global'.
  9. Browse to: /user/1 and view the source and observe that the description meta tag is outputs 'global'.

However, the 7.x-1.0-beta4 version of metatag behaves very differently.

Here are the steps that I performed to verify using the tag 7.x-1.0-beta4:

  1. Perform a clean install of Drupal.
  2. Download and enable the metatag module and it's dependencies.
  3. Override the Global configuration and add 'global' to the description at /admin/config/search/metatags/config/global.
  4. Override the User configuration and add 'user' to the description at /admin/config/search/metatags/config/user.
  5. Browse to: /admin/people/create and expand the Meta Tags fieldset and observe that the description is pre-populated to 'user'.
  6. Browse to: /user/1 and view the source and observe that the description meta tag is outputs 'user'.
  7. Disable the User configuration at /admin/config/search/metatags/ then clear all caches.
  8. Browse to: /admin/people/create and observe that there is no Meta Tags fieldset.
  9. Browse to: /user/1 and view the source and observe that the description meta tag is not output at all.

Based on your earlier comment, I am going to assume that the beta4 version is not behaving correctly. The current functionality in beta5 does make the most sense to me.

The metatag_entity_info_alter function adds 'metatags' => TRUE to the user entity, therefore there should be meta tags for the user entity. Since the User configuration is disabled, it is logical that the Global configuration is inherited.

I am still confused about the patch that I posted. The metatag_entity_has_metatags will always return TRUE if the entity supports metatags, even though the metatag_config_is_enabled function returns FALSE. Returning isset($config_exists[$instance]) will always be TRUE since the introduction of the metatag_config_is_enabled in commit 140a3243d60a1935a2776df6ac459c1dbb713494. The previous implementation would only set $config_exists[$instance] to a non NULL value if there was an enabled configuration.

Sorry for the wall of text, I just want to verify that I understand how the module is supposed to function.

Dave Reid’s picture

Yes, the assumption is that the admin/config/search/metatags/config is the default meta tags configuration only, not 'does this entity type support meta tags or not'. Disabling records there should only disables the defaults.