created css text filter to clean all style attributes in content
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\edlp_admin\Plugin\Filter;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
// use Drupal\Component\Utility\Unicode;
|
||||
// use Drupal\Component\Utility\Xss;
|
||||
use Drupal\filter\FilterProcessResult;
|
||||
use Drupal\filter\Plugin\FilterBase;
|
||||
// use Drupal\Core\Url;
|
||||
// use Drupal\Core\Template\Attribute;
|
||||
|
||||
/**
|
||||
* Provides a filter to convert audio links.
|
||||
*
|
||||
* @Filter(
|
||||
* id = "css",
|
||||
* title = @Translation("Css remove filter"),
|
||||
* description = @Translation("Remove all style attributes"),
|
||||
* type = Drupal\filter\Plugin\FilterInterface::TYPE_TRANSFORM_REVERSIBLE
|
||||
* )
|
||||
*/
|
||||
class CssFilter extends FilterBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process($text, $langcode) {
|
||||
$result = new FilterProcessResult($text);
|
||||
|
||||
$cleaned_text = preg_replace('/style="[^"]*"/i', '', $text);
|
||||
|
||||
$result->setProcessedText($cleaned_text);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ status: true
|
||||
dependencies:
|
||||
config:
|
||||
- core.entity_view_mode.taxonomy_term.notice
|
||||
- field.field.taxonomy_term.entrees.field_color
|
||||
- field.field.taxonomy_term.entrees.field_notice
|
||||
- field.field.taxonomy_term.entrees.field_workflow
|
||||
- taxonomy.vocabulary.entrees
|
||||
@@ -23,5 +24,7 @@ content:
|
||||
region: content
|
||||
hidden:
|
||||
description: true
|
||||
field_color: true
|
||||
field_workflow: true
|
||||
index: true
|
||||
langcode: true
|
||||
|
||||
@@ -4,6 +4,7 @@ status: true
|
||||
dependencies:
|
||||
module:
|
||||
- editor
|
||||
- edlp_admin
|
||||
- edlp_corpus
|
||||
- url_to_video_filter
|
||||
name: wysiwyg
|
||||
@@ -84,3 +85,9 @@ filters:
|
||||
youtube_webp_preview: '0'
|
||||
vimeo: '1'
|
||||
autoload: '0'
|
||||
css:
|
||||
id: css
|
||||
provider: edlp_admin
|
||||
status: true
|
||||
weight: 0
|
||||
settings: { }
|
||||
|
||||
@@ -15,5 +15,6 @@ permissions:
|
||||
- 'access synonyms entity autocomplete'
|
||||
- 'create corpus_documents workflow_transition'
|
||||
- 'create generique workflow_transition'
|
||||
- 'use text format wysiwyg'
|
||||
- 'view published fil entities'
|
||||
- 'view search api pages'
|
||||
|
||||
Reference in New Issue
Block a user