3 namespace Drupal\{{ machine_name }}\Plugin\Filter;
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\filter\FilterProcessResult;
7 use Drupal\filter\Plugin\FilterBase;
10 * Provides a '{{ plugin_label }}' filter.
13 * id = "{{ plugin_id }}",
14 * title = @Translation("{{ plugin_label }}"),
15 * type = Drupal\filter\Plugin\FilterInterface::{{ filter_type }},
22 class {{ class }} extends FilterBase {
27 public function settingsForm(array $form, FormStateInterface $form_state) {
29 '#type' => 'textfield',
30 '#title' => $this->t('Example'),
31 '#default_value' => $this->settings['example'],
32 '#description' => $this->t('Description of the setting.'),
40 public function process($text, $langcode) {
41 // @DCG Process text here.
42 $example = $this->settings['example'];
43 $text = str_replace($example, "<b>$example</b>", $text);
44 return new FilterProcessResult($text);
50 public function tips($long = FALSE) {
51 return $this->t('Some filter tips here.');