Guest User

Untitled

a guest
Oct 26th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. namespace Drupalamu_dud_custom_filtersPluginFilter;
  2.  
  3. use DrupalComponentUtilityHtml;
  4. use DrupalfilterFilterProcessResult;
  5. use DrupalfilterPluginFilterBase;
  6.  
  7. /**
  8. * Provides a filter to align elements.
  9. *
  10. * @Filter(
  11. * id = "iframe",
  12. * title = @Translation("iframe"),
  13. * description = @Translation(("restrict iframe to 100% height for responsiveness")),
  14. * type = DrupalfilterPluginFilterInterface::TYPE_TRANSFORM_REVERSIBLE
  15. * )
  16. */
  17. class AmuDudFilters extends FilterBase {
  18.  
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function process($text, $langcode) {
  23. $result = new FilterProcessResult($text);
  24.  
  25. if (stristr($text, 'data-align') !== FALSE) {
  26. $dom = Html::load($text);
  27. $result->setProcessedText(Html::serialize($dom));
  28. }
  29.  
  30. return $result;
  31. }
Add Comment
Please, Sign In to add comment