abstract class WordfilterProcessBase in Wordfilter 8.2
Base class for Wordfilter Process plugins.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\wordfilter\Plugin\WordfilterProcessBase implements WordfilterProcessInterface
Expanded class hierarchy of WordfilterProcessBase
2 files declare their use of WordfilterProcessBase
- DefaultWordfilterProcess.php in src/
Plugin/ WordfilterProcess/ DefaultWordfilterProcess.php - TokenWordfilterProcess.php in src/
Plugin/ WordfilterProcess/ TokenWordfilterProcess.php
File
- src/
Plugin/ WordfilterProcessBase.php, line 13
Namespace
Drupal\wordfilter\PluginView source
abstract class WordfilterProcessBase extends PluginBase implements WordfilterProcessInterface {
/**
* Prepares the filter words for being used inside a regular expression.
*
* @param array $words
* The (not yet) prepared filter words.
*
* @return array
* The filter words, ready to be used inside a regular expression.
*/
protected function prepareWordsForRegex(array $words) {
$prepared = [];
foreach ($words as $delta => $word) {
$prepared[$delta] = preg_quote(Xss::filterAdmin($word), '/');
if (strlen($prepared[$delta]) === strlen($word)) {
// Use word boundaries for 'naturally spoken' words.
$prepared[$delta] = '\\b' . $prepared[$delta] . '\\b';
}
}
return $prepared;
}
/**
* {@inheritdoc}
*/
public function settingsForm(array $form, FormStateInterface $form_state, WordfilterConfigurationInterface $wordfilter_config) {
$definition = $this
->getPluginDefinition();
return [
'description' => [
'#markup' => '<em>' . t('Process description') . '</em>: ' . $definition['description'],
'#weight' => 0,
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | 92 |
WordfilterProcessBase:: |
protected | function | Prepares the filter words for being used inside a regular expression. | |
WordfilterProcessBase:: |
public | function |
Additional settings form according to the given Wordfilter configuration. Overrides WordfilterProcessInterface:: |
|
WordfilterProcessInterface:: |
public | function | Provides filtering of words by the given Wordfilter configuration. | 2 |