3 namespace Drupal\metatag;
5 use Drupal\Core\Entity\ContentEntityInterface;
6 use Drupal\views\ViewEntityInterface;
9 * Class MetatagManager.
11 * @package Drupal\metatag
13 interface MetatagManagerInterface {
16 * Extracts all tags of a given entity.
18 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
19 * The content entity to extract metatags from.
24 public function tagsFromEntity(ContentEntityInterface $entity);
27 * Extracts all tags of a given entity, and combines them with sitewide,
28 * per-entity-type, and per-bundle defaults.
30 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
31 * The content entity to extract metatags from.
36 public function tagsFromEntityWithDefaults(ContentEntityInterface $entity);
39 * Extracts all appropriate default tags for an entity, from sitewide,
40 * per-entity-type, and per-bundle defaults.
42 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
43 * The content entity for which to calculate defaults.
48 public function defaultTagsFromEntity(ContentEntityInterface $entity);
51 * Returns an array of group plugin information sorted by weight.
54 * Array of groups, sorted by weight.
56 public function sortedGroups();
59 * Returns an array of tag plugin information sorted by group then weight.
62 * Array of tags, sorted by weight.
64 public function sortedTags();
67 * Returns a weighted array of groups containing their weighted tags.
70 * Array of sorted tags, in groups.
72 public function sortedGroupsWithTags();
75 * Builds the form element for a Metatag field.
77 * If a list of either groups or tags are passed in, those will be used to
78 * limit the groups/tags on the form. If nothing is passed in, all groups
79 * and tags will be used.
81 * @param array $values
83 * @param array $element
85 * @param mixed $token_types
86 * Token types to return in the tree.
87 * @param array $included_groups
88 * Available group plugins.
89 * @param array $included_tags
90 * Available tag plugins.
93 * Render array for metatag form.
95 public function form(array $values, array $element, array $token_types = [], array $included_groups = NULL, array $included_tags = NULL);