TermMatcher.php in Linkit 8.5
File
src/Plugin/Linkit/Matcher/TermMatcher.php
View source
<?php
namespace Drupal\linkit\Plugin\Linkit\Matcher;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\linkit\Utility\LinkitXss;
class TermMatcher extends EntityMatcher {
public function calculateDependencies() {
return parent::calculateDependencies() + [
'module' => [
'taxonomy',
],
];
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$this
->insertTokenList($form, [
'term',
]);
return $form;
}
protected function buildDescription(EntityInterface $entity) {
$description = \Drupal::token()
->replace($this->configuration['metadata'], [
'term' => $entity,
], []);
return LinkitXss::descriptionFilter($description);
}
}
Classes
Name |
Description |
TermMatcher |
Provides specific linkit matchers for the taxonomy_term entity type. |