Commit f8020572 authored by Damien McKenna's avatar Damien McKenna
Browse files

Issue #3113761 by DamienMcKenna, thalles, rokzabukovec, Diego_Mow,...

Issue #3113761 by DamienMcKenna, thalles, rokzabukovec, Diego_Mow, urvashi_vora: Coding standards cleanup.
parent e4dbec9e
Loading
Loading
Loading
Loading
+2 −0
Changes for CHANGELOG.txt: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@ Metatag 8.x-1.x-dev, 2022-xx-xx
  metatag_display_extender.
#3258346 by Eugene Bocharov, jedgar1mx, 4kant, Renrhaf, DamienMcKenna, kriboogh:
  Error: Call to a member function __wakeup() on null.
#3113761 by DamienMcKenna, thalles, rokzabukovec, Diego_Mow, urvashi_vora:
  Coding standards cleanup.


Metatag 8.x-1.19, 2022-01-06
+13 −3
Changes for metatag.module: 13 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
 * Contains metatag.module.
 */

use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\Component\Plugin\Factory\DefaultFactory;
use Drupal\Component\Utility\Html;
use Drupal\Core\Entity\ContentEntityInterface;
@@ -301,11 +302,12 @@ function _metatag_remove_duplicate_entity_tags(array &$build) {
    // Check to see if the page currently outputs a canonical and/or shortlink
    // tag.
    if (isset($metatag_attachments['#attached']['html_head'])) {
      $tags_to_look_for = ['canonical', 'shortlink'];
      foreach ($metatag_attachments['#attached']['html_head'] as $metatag_item) {
        if (in_array($metatag_item[1], ['canonical_url', 'shortlink'])) {
          // Metatag provides rel="canonical" and/or rel="shortlink" tags.
          foreach ($build['#attached']['html_head_link'] as $key => $item) {
            if (isset($item[0]['rel']) && in_array($item[0]['rel'], ['canonical', 'shortlink'])) {
            if (isset($item[0]['rel']) && in_array($item[0]['rel'], $tags_to_look_for)) {
              // Remove the link rel="canonical" or link rel="shortlink" tag
              // from the entity's build array.
              unset($build['#attached']['html_head_link'][$key]);
@@ -808,24 +810,31 @@ function metatag_migrate_prepare_row(Row $row, MigrateSourceInterface $source, M
      // @todo Write a more general version rather than a switch statement.
      switch ($source_type) {
        case 'node':
          // @code
          // define('NODEWORDS_TYPE_NODE', 5);
          // @endcode
          $nodeword_type = 5;
          $entity_id = $row->getSourceProperty('nid');
          break;

        case 'taxonomy_term':
          // @code
          // define('NODEWORDS_TYPE_TERM', 6);
          // @endcode
          $nodeword_type = 6;
          $entity_id = $row->getSourceProperty('tid');
          break;

        case 'user':
          // @code
          // define('NODEWORDS_TYPE_USER', 8);
          // @endcode
          $nodeword_type = 8;
          $entity_id = $row->getSourceProperty('uid');
          break;
      }
      // @todo
      // @todo Migrate these configuration items.
      // @code
      // define('NODEWORDS_TYPE_BLOG',       13);
      // define('NODEWORDS_TYPE_DEFAULT',    1);
      // define('NODEWORDS_TYPE_ERRORPAGE',  2);
@@ -837,6 +846,7 @@ function metatag_migrate_prepare_row(Row $row, MigrateSourceInterface $source, M
      // define('NODEWORDS_TYPE_PAGER',      4);
      // define('NODEWORDS_TYPE_TRACKER',    7);
      // define('NODEWORDS_TYPE_VOCABULARY', 9);
      // @endcode

      /** @var \Drupal\migrate\Plugin\migrate\source\SqlBase $source */
      /** @var \Drupal\Core\Database\Query\SelectInterface $query */
@@ -1001,7 +1011,7 @@ function _metatag_is_migration_plugin_supported(array $definition) {
      return FALSE;
    }
  }
  catch (\Drupal\Component\Plugin\Exception\PluginNotFoundException $e) {
  catch (PluginNotFoundException $e) {
    // If the entity type doesn't exist, neither with the migration plugin.
    return FALSE;
  }
+3 −1
Changes for metatag_extended_perms/tests/src/Functional/PermissionsTest.php: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -70,11 +70,13 @@ class PermissionsTest extends BrowserTestBase {
      'revisit_after' => 'Revisit After',
      'rights' => 'Rights',
      // This one is more complicated, so skip it.
      // @code
      // 'robots' => 'Robots',
      // @endcode
      'set_cookie' => 'Set cookie',
      'shortlink' => 'Shortlink URL',
      'standout' => 'Standout',
    ]
    ],
  ];

  /**
+2 −1
Changes for metatag_favicons/metatag_favicons.module: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -34,10 +34,11 @@ function metatag_favicons_page_attachments_alter(array &$attachments) {
  }

  // Remove the default shortcut icon if one was set by Metatag.
  $valid_meta_tags = ['shortcut_icon', 'icon'];
  foreach ($attachments['#attached']['html_head'] as $element) {
    if (isset($element[1]) && in_array($element[1], ['shortcut_icon', 'icon'])) {
      foreach ($attachments['#attached']['html_head_link'] as $key => $value) {
        if (isset($value[0]['rel']) && in_array($value[0]['rel'], ['shortcut_icon', 'icon'])) {
        if (isset($value[0]['rel']) && in_array($value[0]['rel'], $valid_meta_tags)) {
          unset($attachments['#attached']['html_head_link'][$key]);
        }
      }
+1 −1
Changes for metatag_hreflang/metatag_hreflang.module: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ function metatag_hreflang_page_attachments_alter(array &$attachments) {
      foreach ($attachments['#attached']['html_head'] as $element) {
        // Check for Metatag's identifier "hreflang_per_language".
        if (!empty($element[1])) {
          if (strpos($element[1], 'hreflang_per_language') !== false && isset($element[0]['#attributes']['hreflang'])) {
          if (strpos($element[1], 'hreflang_per_language') !== FALSE && isset($element[0]['#attributes']['hreflang'])) {
            $hreflang_per_language[] = $element[0]['#attributes']['hreflang'];
          }
        }
Loading