It would be great if you could just turn off the admin UI for metatags on a per entity type and/or bundle basis. The fieldset to specify metatags on an entity edit form is pretty heavy. We've found it helpful to prevent metatag from adding the fieldset. Metatag doesn't provide a way to turn the Admin UI off, while leaving the config enabled. This is also handy b/c for some entity bundles, you really don't want editors changing things here, plus if a metatag config for an individual entity gets saved, you loose the ability for changes in the defaults to have an effect on it.

Going to create a quick patch to give you an option to set a variable to turn this off. Would probably also be handy to expose this variable in Advanced settings it there is interest.

Comments

m4olivei’s picture

StatusFileSize
new2.72 KB

Here's a basic patch that works. Allows you to define a variable of the form:

metatag_enable_ui_{$entity_type}__{$bundle}
metatag_enable_ui_{$entity_type}

To disable the admin form for a particular entity type and/or bundle, just set this var to FALSE, it defaults to TRUE. eg.

// Disable metatags UI for carousel nodes.
$conf['metatag_enable_ui_node__carousel'] = FALSE;

// Disable metatags UI for file_entity.
$conf['metatag_enable_ui_file'] = FALSE;
damienmckenna’s picture

Status: Active » Closed (works as designed)

You can already disable the fields for different entities via the settings page, so this would be duplicate functionality.

m4olivei’s picture

Version: 7.x-1.4 » 7.x-1.7
Status: Closed (works as designed) » Needs review
StatusFileSize
new2.1 KB

@DamienMeKenna if you disable the field for the bundle on the settings page, it will disable the metatag config for that bundle as well as the admin form right? In our case, we wanted to disable just the admin form to save bloat on the form and to avoid a scenario where values were saved inadvertently for an entity, which then overrides the default metatag settings.

Here is an updated patch against 7.x-1.7, which we are currently testing.

Status: Needs review » Needs work

The last submitted patch, 3: disable_admin_ui-2508363-2.patch, failed testing.

m4olivei’s picture

StatusFileSize
new1.91 KB

Oops, didn't make that patch relative. Updated.

damienmckenna’s picture

Version: 7.x-1.7 » 7.x-1.x-dev
Status: Needs work » Needs review

The last submitted patch, 1: disable_admin_ui-2508363-1.patch, failed testing.

damienmckenna’s picture

Status: Needs review » Needs work

This should follow the logic currently used for the other functionality, and provide options on the settings form.

damienmckenna’s picture

FYI the D8 branch works in the opposite direction - the site builder has to manually add the form field to entity bundles where the fields should be visible, rather than adding it everywhere.

Maybe you should just update to D8? ;-)

damienmckenna’s picture

It's also possible to use hook_form_alter() to set $form['metatags']['#access'] to FALSE as needed.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new1.91 KB

Here's a quick reroll of the patch from #5, no other changes were made.

damienmckenna’s picture

Status: Needs review » Needs work

Back to Needs Work.

damienmckenna’s picture

Assigned: m4olivei » Unassigned
bluegeek9’s picture

Status: Needs work » Closed (outdated)
//www.flaticon.com/free-icons/thank-you Thank you for your contribution!
Unfortunatly Drupal 7 is no longer supported. We encourage you to upgrade to a modern version of Drupal.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.