ShortcodeCorrector.php in Shortcode 2.0.x
Same filename and directory in other branches
Namespace
Drupal\shortcode\Plugin\FilterFile
src/Plugin/Filter/ShortcodeCorrector.phpView source
<?php
namespace Drupal\shortcode\Plugin\Filter;
use Drupal\Core\Form\FormStateInterface;
use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;
/**
* Filter that corrects html added by wysiwyg editors around shortcodes.
*
* @Filter(
* id = "shortcode_corrector",
* module = "shortcode",
* title = @Translation("Shortcodes - html corrector"),
* description = @Translation("Trying to correct the html around shortcodes. Enable only if you using wysiwyg editor."),
* type = Drupal\filter\Plugin\FilterInterface::TYPE_MARKUP_LANGUAGE,
* )
*/
class ShortcodeCorrector extends FilterBase {
/**
* {@inheritdoc}
*/
public function settingsForm(array $form, FormStateInterface $form_state) {
return [];
}
/**
* {@inheritdoc}
*/
public function process($text, $langcode) {
if (!empty($text)) {
/** @var \Drupal\shortcode\Shortcode\ShortcodeService $shortcodeEngine */
$shortcodeEngine = \Drupal::service('shortcode');
$text = $shortcodeEngine
->postprocessText($text, $langcode, $this);
}
return new FilterProcessResult($text);
}
}
Classes
Name | Description |
---|---|
ShortcodeCorrector | Filter that corrects html added by wysiwyg editors around shortcodes. |