Commit 5de8438b authored by Damien McKenna's avatar Damien McKenna Committed by Damien McKenna
Browse files

Issue #3326103 by DamienMcKenna, harshitthakore: Remove the old TypedData...

Issue #3326103 by DamienMcKenna, harshitthakore: Remove the old TypedData plugin for Search API integration.
parent 89b221db
Loading
Loading
Loading
Loading
+2
Changes for CHANGELOG.txt: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@ Metatag 2.0.x-dev, 2022-xx-xx
#3164404 by DamienMcKenna: Rewrite tags testing architecture.
#3305586 by DamienMcKenna: Remove Panelizer support.
#3272768 by DamienMcKenna, SandeepSingh199: Convert to JSON data storage.
#3326103 by DamienMcKenna, harshitthakore: Remove the old TypedData plugin for
  Search API integration.


Metatag 8.x-1.x-dev, 2022-xx-xx
−43
Changes for README.md: 0 added lines, 43 removed lines.
Original line number Diff line number Diff line
@@ -135,49 +135,6 @@ Metatag field entirely, then use tokens for those fields in the defaults
display, or just left hidden.


## Indexing meta tags with Search API

The Search API integration allows indexing the meta tag values from a meta tag
field on an entity bundle.

### Limitations

* Each meta tag must be specified individually, there isn't (currently) a way to
  add all of them at once.
* This may not work with values stored in Schema.org data structures from the
  Schema.org Metatag module.
* Changing the global Metatag defaults will not trigger a reindex of the content
  so this will need to be done separately.
* By default meta tags will be added as "string" fields, which will not include
  them in the keyword search index; their "Type" selection must be specifically
  set to "Fulltext" in order for the meta tags to be included in the keyword
  search index, otherwise they will only be useful for doing facets or filters.

### Setup

To add meta tags to the Search API:

* Make sure that a Metatag field is present on the entity bundle(s) that are
  being indexed.
* In the index configuration, modify the Fields section.
* Click the "Add fields" button.
* In the "Add fields to index [indexname]" popup, scroll down to find the
  Metatag field; it will have the name defined in the field's settings.
* Click the plus `(+)` button beside the field to see which meta tags are
  available.
* Click the "Add" button for the meta tags that are needed.
* Click "Done" when all of the meta tags are added.
* Look for the meta tag fields added to the index, change their "type" selector
  to "Fulltext"; adjust the "Boost" value if desired.
* Click "Save changes" at the bottom of the Fields admin page.
* Reindex the content with the new settings.

### Deprecated

Note that this specific Search API integration has been deprecated in release
8.x-1.23 and a replacement will be added separately to a future release.


## Alternative option to simplify the content administration experience

On the settings page (/admin/config/search/metatag/settings) are options to
−14
Changes for src/Plugin/Field/FieldType/MetatagFieldItem.php: 0 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -47,20 +47,6 @@ class MetatagFieldItem extends FieldItemBase {
      ->setLabel(t('Metatag'))
      ->setRequired(TRUE);

    $sorted_tags = \Drupal::service('metatag.manager')->sortedGroupsWithTags();

    foreach ($sorted_tags as $group_id => $group) {
      if (isset($group['tags'])) {
        foreach ($group['tags'] as $tag_id => $tag) {
          $properties[$tag_id] = DataDefinition::create('string')
            ->setLabel(t('@label', ['@label' => $tag['label']]))
            ->setComputed(TRUE)
            ->setClass('\Drupal\metatag\TypedData\IndividualTag')
            ->setSetting('tag_name', $tag_id);
        }
      }
    }

    return $properties;
  }

−105

File deleted.