Loading CHANGELOG.txt +2 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx ------------------------------- #3165112 by Wim Leers, tim.plunkett: Metatag migrations should be tagged "Configuration". #2782797 by DamienMcKenna, Rolf van de Krol, michaelpetri, mvwensen, mxr576, Alex G: Allow each tag to have its own permission (merge Metatag Access). Metatag 8.x-1.14, 2020-08-11 Loading metatag_extended_perms/README.txt 0 → 100644 +35 −0 Original line number Diff line number Diff line Metatag Extended Permissions ---------------------------- This add-on for Metatag creates a new permission for each individual meta tag, allowing for very fine controlled access over meta tag customization. Usage -------------------------------------------------------------------------------- * Enable the Metatag Extended Permissions module. * Assign the appropriate permissions via the admin/people/permisisons page. Known issues -------------------------------------------------------------------------------- This module introduces a possibility for dramatically increasing the number of checkboxes on the permissions page. This can lead to the following problems: * The permissions admin page or node forms taking a long time to load. * PHP timeout errors on the permissions admin or node forms pages. * Out-of-memory errors loading the above. * The web server not being able to process the permissions form due to hitting PHP's max_input_vars limit. Because of these, it is advised to fully test this module on a copy of a site before enabling it on production, to help ensure these problems are not encountered. Credits / contact -------------------------------------------------------------------------------- Originally written by Michael Petri [1]. References -------------------------------------------------------------------------------- 1: https://www.drupal.org/u/michaelpetri metatag_extended_perms/metatag_extended_perms.info.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line name: Metatag Extended Permissions type: module description: "Adds individual permissions for each meta tag, allowing for fine-grained access to the meta tags. Note: this may nead to performance issues on the permissions admin page, please see the included README.txt file for details." core_version_requirement: '^8.7.7 || ^9' package: SEO dependencies: - metatag metatag_extended_perms/metatag_extended_perms.module 0 → 100644 +43 −0 Original line number Diff line number Diff line <?php /** * @file * Primary hook implementations for metatag_extended_perms. */ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; use Drupal\metatag\Plugin\Field\FieldWidget\MetatagFirehose; /** * Implements hook_field_widget_form_alter(). */ function metatag_extended_perms_field_widget_form_alter(&$element, FormStateInterface $form_state, $context) { if ($context['widget'] instanceof MetatagFirehose) { $group_manager = \Drupal::getContainer()->get('plugin.manager.metatag.group'); foreach (Element::children($element) as $group_id) { $group = $group_manager->getDefinition($group_id, FALSE); if ($group === NULL) { continue; } // By default restrict access to group and regain access when user has // access to at least one tag in group; this prevents displaying empty // groups. $element[$group_id]['#access'] = FALSE; // Check through each meta tag field on the field widget. foreach (Element::children($element[$group_id]) as $tag_id) { // Check tag permission. $element[$group_id][$tag_id]['#access'] = \Drupal::currentUser() ->hasPermission('access metatag ' . $group_id . '__' . $tag_id); // Make the group accessible if user has access to the tag. if ($element[$group_id][$tag_id]['#access']) { $element[$group_id]['#access'] = TRUE; } } } } } metatag_extended_perms/metatag_extended_perms.permissions.yml 0 → 100644 +6 −0 Original line number Diff line number Diff line # @file # Provide individual permissions for each meta tag available on the site. # All of the actual permissions are provided by a callback. permission_callbacks: - Drupal\metatag_extended_perms\MetatagPermissions::permissions Loading
CHANGELOG.txt +2 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx ------------------------------- #3165112 by Wim Leers, tim.plunkett: Metatag migrations should be tagged "Configuration". #2782797 by DamienMcKenna, Rolf van de Krol, michaelpetri, mvwensen, mxr576, Alex G: Allow each tag to have its own permission (merge Metatag Access). Metatag 8.x-1.14, 2020-08-11 Loading
metatag_extended_perms/README.txt 0 → 100644 +35 −0 Original line number Diff line number Diff line Metatag Extended Permissions ---------------------------- This add-on for Metatag creates a new permission for each individual meta tag, allowing for very fine controlled access over meta tag customization. Usage -------------------------------------------------------------------------------- * Enable the Metatag Extended Permissions module. * Assign the appropriate permissions via the admin/people/permisisons page. Known issues -------------------------------------------------------------------------------- This module introduces a possibility for dramatically increasing the number of checkboxes on the permissions page. This can lead to the following problems: * The permissions admin page or node forms taking a long time to load. * PHP timeout errors on the permissions admin or node forms pages. * Out-of-memory errors loading the above. * The web server not being able to process the permissions form due to hitting PHP's max_input_vars limit. Because of these, it is advised to fully test this module on a copy of a site before enabling it on production, to help ensure these problems are not encountered. Credits / contact -------------------------------------------------------------------------------- Originally written by Michael Petri [1]. References -------------------------------------------------------------------------------- 1: https://www.drupal.org/u/michaelpetri
metatag_extended_perms/metatag_extended_perms.info.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line name: Metatag Extended Permissions type: module description: "Adds individual permissions for each meta tag, allowing for fine-grained access to the meta tags. Note: this may nead to performance issues on the permissions admin page, please see the included README.txt file for details." core_version_requirement: '^8.7.7 || ^9' package: SEO dependencies: - metatag
metatag_extended_perms/metatag_extended_perms.module 0 → 100644 +43 −0 Original line number Diff line number Diff line <?php /** * @file * Primary hook implementations for metatag_extended_perms. */ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; use Drupal\metatag\Plugin\Field\FieldWidget\MetatagFirehose; /** * Implements hook_field_widget_form_alter(). */ function metatag_extended_perms_field_widget_form_alter(&$element, FormStateInterface $form_state, $context) { if ($context['widget'] instanceof MetatagFirehose) { $group_manager = \Drupal::getContainer()->get('plugin.manager.metatag.group'); foreach (Element::children($element) as $group_id) { $group = $group_manager->getDefinition($group_id, FALSE); if ($group === NULL) { continue; } // By default restrict access to group and regain access when user has // access to at least one tag in group; this prevents displaying empty // groups. $element[$group_id]['#access'] = FALSE; // Check through each meta tag field on the field widget. foreach (Element::children($element[$group_id]) as $tag_id) { // Check tag permission. $element[$group_id][$tag_id]['#access'] = \Drupal::currentUser() ->hasPermission('access metatag ' . $group_id . '__' . $tag_id); // Make the group accessible if user has access to the tag. if ($element[$group_id][$tag_id]['#access']) { $element[$group_id]['#access'] = TRUE; } } } } }
metatag_extended_perms/metatag_extended_perms.permissions.yml 0 → 100644 +6 −0 Original line number Diff line number Diff line # @file # Provide individual permissions for each meta tag available on the site. # All of the actual permissions are provided by a callback. permission_callbacks: - Drupal\metatag_extended_perms\MetatagPermissions::permissions