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:
|
dependencies:
|
||||||
config:
|
config:
|
||||||
- core.entity_view_mode.taxonomy_term.notice
|
- 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_notice
|
||||||
- field.field.taxonomy_term.entrees.field_workflow
|
- field.field.taxonomy_term.entrees.field_workflow
|
||||||
- taxonomy.vocabulary.entrees
|
- taxonomy.vocabulary.entrees
|
||||||
@@ -23,5 +24,7 @@ content:
|
|||||||
region: content
|
region: content
|
||||||
hidden:
|
hidden:
|
||||||
description: true
|
description: true
|
||||||
|
field_color: true
|
||||||
field_workflow: true
|
field_workflow: true
|
||||||
|
index: true
|
||||||
langcode: true
|
langcode: true
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ status: true
|
|||||||
dependencies:
|
dependencies:
|
||||||
module:
|
module:
|
||||||
- editor
|
- editor
|
||||||
|
- edlp_admin
|
||||||
- edlp_corpus
|
- edlp_corpus
|
||||||
- url_to_video_filter
|
- url_to_video_filter
|
||||||
name: wysiwyg
|
name: wysiwyg
|
||||||
@@ -84,3 +85,9 @@ filters:
|
|||||||
youtube_webp_preview: '0'
|
youtube_webp_preview: '0'
|
||||||
vimeo: '1'
|
vimeo: '1'
|
||||||
autoload: '0'
|
autoload: '0'
|
||||||
|
css:
|
||||||
|
id: css
|
||||||
|
provider: edlp_admin
|
||||||
|
status: true
|
||||||
|
weight: 0
|
||||||
|
settings: { }
|
||||||
|
|||||||
@@ -15,5 +15,6 @@ permissions:
|
|||||||
- 'access synonyms entity autocomplete'
|
- 'access synonyms entity autocomplete'
|
||||||
- 'create corpus_documents workflow_transition'
|
- 'create corpus_documents workflow_transition'
|
||||||
- 'create generique workflow_transition'
|
- 'create generique workflow_transition'
|
||||||
|
- 'use text format wysiwyg'
|
||||||
- 'view published fil entities'
|
- 'view published fil entities'
|
||||||
- 'view search api pages'
|
- 'view search api pages'
|
||||||
|
|||||||
Reference in New Issue
Block a user