We have a number of custom entities on our site, and we had working support for metatags prior to the 7036 update.

Our entity has only one bundle (and we had no metatag key on the bundle in our entity info), so metatag_update_7036 set the variable:
metatag_enable_[custom_entity]
to FALSE, based on logic in metatag_update_7036.

The User Interface does not allow us to unset this option (since the user interface only shows a checkbox for the entity, if only one bundle exists).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rollsd created an issue. See original summary.

daniel.rolls@flightcentre.com.au’s picture

I propose we change the way metatag_entity_supports_metatags handles entities with only one bundle to match the behavior in the UI.

IN metatag_entity_supports_metatags before we check the option for each bundle:

            // If only one bundle exists, take configuration for entity, to
            // reflect options as they are available in the UI.
            if (count($entity_info['bundles']) === 1) {
              $entity_types[$entity_name][$bundle_name] = !empty(variable_get('metatag_enable_' . $entity_name, FALSE));
              continue;
            }

See attached patch.

daniel.rolls@flightcentre.com.au’s picture

Note this fix works for our custom entities, and even though the configuration variable relating to its bundle:
metatag_enable_{$entity_name}_{$entity_name}
remains set to FALSE, this doesn't present a problem because if we add another bundle later on, the option to unset this will be available through the user interface.

DamienMcKenna’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: metatag-fix_single_bundles_entities-2622662-1.patch, failed testing.

daniel.rolls@flightcentre.com.au’s picture

Have fixed up the patch to remove the return value passed through as arg. Also removed accidental file mode change.

daniel.rolls@flightcentre.com.au’s picture

Status: Needs work » Needs review
DamienMcKenna’s picture

Thanks for fixing the patch, @rollsd. I'll try to include it in the next release.

DamienMcKenna’s picture

DamienMcKenna’s picture

The tests still run.

DamienMcKenna’s picture

DamienMcKenna’s picture

Status: Needs review » Fixed

Committed. Thanks!

  • DamienMcKenna committed a640b9f on 7.x-1.x authored by rollsd
    Issue #2622662 by rollsd: Adjusted logic to fix problem with entity...

Status: Fixed » Closed (fixed)

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