FilterHtmlImageSecure.php

Same filename in other branches
  1. 9 core/modules/filter/src/Plugin/Filter/FilterHtmlImageSecure.php
  2. 10 core/modules/filter/src/Plugin/Filter/FilterHtmlImageSecure.php
  3. 11.x core/modules/filter/src/Plugin/Filter/FilterHtmlImageSecure.php

Namespace

Drupal\filter\Plugin\Filter

File

core/modules/filter/src/Plugin/Filter/FilterHtmlImageSecure.php

View source
<?php

namespace Drupal\filter\Plugin\Filter;

use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;

/**
 * Provides a filter to restrict images to site.
 *
 * @Filter(
 *   id = "filter_html_image_secure",
 *   title = @Translation("Restrict images to this site"),
 *   description = @Translation("Disallows usage of &lt;img&gt; tag sources that are not hosted on this site by replacing them with a placeholder image."),
 *   type = Drupal\filter\Plugin\FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE,
 *   weight = 9
 * )
 */
class FilterHtmlImageSecure extends FilterBase {
    
    /**
     * {@inheritdoc}
     */
    public function process($text, $langcode) {
        return new FilterProcessResult(_filter_html_image_secure_process($text));
    }
    
    /**
     * {@inheritdoc}
     */
    public function tips($long = FALSE) {
        return $this->t('Only images hosted on this site may be used in &lt;img&gt; tags.');
    }

}

Classes

Title Deprecated Summary
FilterHtmlImageSecure Provides a filter to restrict images to site.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.