Commit 4369ba4e authored by Damien McKenna's avatar Damien McKenna Committed by Damien McKenna
Browse files

Issue #3305751 by DamienMcKenna: Fix coding standards issues.

parent e8447872
Loading
Loading
Loading
Loading
+5 −2
Changes for src/Form/MetatagDefaultsForm.php: 5 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -157,7 +157,9 @@ class MetatagDefaultsForm extends EntityForm {
    $entity_type_groups = $settings->get('entity_type_groups');

    // Find the current entity type and bundle.
    if ($metatag_defaults_id = $metatag_defaults->id()) {
    $entity_bundle = NULL;
    $metatag_defaults_id = $metatag_defaults->id();
    if (!empty($metatag_defaults_id)) {
      $type_parts = explode('__', $metatag_defaults_id);
      $entity_type = $type_parts[0];
      $entity_bundle = $type_parts[1] ?? NULL;
@@ -303,6 +305,7 @@ class MetatagDefaultsForm extends EntityForm {
    }

    $form_state->setRedirectUrl($metatag_defaults->toUrl('collection'));
    // @todo This is expected to return an INT value.
  }

  /**
@@ -403,7 +406,7 @@ class MetatagDefaultsForm extends EntityForm {
  /**
   * Route title callback.
   *
   * @param \Drupal\metatag\MetatagDefaultsInterface|null $metatag_defaults
   * @param \Drupal\metatag\MetatagDefaultsInterface $metatag_defaults
   *   Metatags default entity.
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup
+5 −23
Changes for src/MetatagManager.php: 5 added lines, 23 removed lines.
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ class MetatagManager implements MetatagManagerInterface {
  /**
   * The Metatag defaults.
   *
   * @var array
   * @var \Drupal\metatag\Entity\MetatagDefaults
   */
  protected $metatagDefaults;

@@ -384,7 +384,7 @@ class MetatagManager implements MetatagManagerInterface {
        $field_type = $definition->getType();

        // Check the field type against our list of fields.
        if (isset($field_type) && in_array($field_type, $field_types)) {
        if (!empty($field_type) && in_array($field_type, $field_types)) {
          $field_list[$field_name] = $definition;
        }
      }
@@ -540,15 +540,7 @@ class MetatagManager implements MetatagManagerInterface {
  }

  /**
   * Generate the elements that go in the hook_page_attachments attached array.
   *
   * @param array $tags
   *   The array of tags as plugin_id => value.
   * @param object $entity
   *   Optional entity object to use for token replacements.
   *
   * @return array
   *   Render array with tag elements.
   * {@inheritdoc}
   */
  public function generateElements(array $tags, $entity = NULL) {
    $elements = [];
@@ -567,17 +559,7 @@ class MetatagManager implements MetatagManagerInterface {
  }

  /**
   * Generate the actual meta tag values.
   *
   * @param array $tags
   *   The array of tags as plugin_id => value.
   * @param object $entity
   *   Optional entity object to use for token replacements.
   * @param \Drupal\Core\Render\BubbleableMetadata|null $cache
   *   (optional) Cacheability metadata.
   *
   * @return array
   *   Render array with tag elements.
   * {@inheritdoc}
   */
  public function generateRawElements(array $tags, $entity = NULL, BubbleableMetadata $cache = NULL) {
    // Ignore the update.php path.
@@ -752,7 +734,7 @@ class MetatagManager implements MetatagManagerInterface {
   * @return array|string
   *   Processed value.
   */
  protected function processTagValue($tag, $value, array $token_replacements, bool $plain_text = FALSE, $langcode = FALSE) {
  protected function processTagValue($tag, $value, array $token_replacements, bool $plain_text = FALSE, $langcode = '') {
    // Set the value as sometimes the data needs massaging, such as when
    // field defaults are used for the Robots field, which come as an array
    // that needs to be filtered and converted to a string.
+29 −0
Changes for src/MetatagManagerInterface.php: 29 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
namespace Drupal\metatag;

use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Render\BubbleableMetadata;

/**
 * Class MetatagManager.
@@ -98,4 +99,32 @@ interface MetatagManagerInterface {
   */
  public function form(array $values, array $element, array $token_types = [], array $included_groups = NULL, array $included_tags = NULL, $verbose_help = FALSE);

  /**
   * Generate the elements that go in the hook_page_attachments attached array.
   *
   * @param array $tags
   *   The array of tags as plugin_id => value.
   * @param object $entity
   *   Optional entity object to use for token replacements.
   *
   * @return array
   *   Render array with tag elements.
   */
  public function generateElements(array $tags, $entity = NULL);

  /**
   * Generate the actual meta tag values.
   *
   * @param array $tags
   *   The array of tags as plugin_id => value.
   * @param object $entity
   *   Optional entity object to use for token replacements.
   * @param \Drupal\Core\Render\BubbleableMetadata|null $cache
   *   (optional) Cacheability metadata.
   *
   * @return array
   *   Render array with tag elements.
   */
  public function generateRawElements(array $tags, $entity = NULL, BubbleableMetadata $cache = NULL);

}
+7 −0
Changes for src/Plugin/metatag/Tag/MetaNameBase.php: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -109,6 +109,13 @@ abstract class MetaNameBase extends PluginBase {
   */
  protected $value;

  /**
   * The sort order for this meta tag.
   *
   * @var int
   */
  protected $weight;

  /**
   * The attribute this tag uses for the name.
   *
+6 −2
Changes for src/Plugin/migrate/source/d6/NodewordsFieldInstance.php: 6 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -121,14 +121,18 @@ class NodewordsFieldInstance extends DrupalSqlBase {
   * {@inheritdoc}
   */
  public function count($refresh = FALSE) {
    return $this->initializeIterator()->count();
    /** @var \ArrayIterator $items */
    $items = $this->initializeIterator();
    return $items->count();
  }

  /**
   * {@inheritdoc}
   */
  protected function doCount() {
    return $this->initializeIterator()->count();
    /** @var \ArrayIterator $items */
    $items = $this->initializeIterator();
    return $items->count();
  }

}