function theme_filter_html_image_secure_image

Formats an image DOM element that has an invalid source.

Parameters

DOMElement $image: An IMG node to format, parsed from the filtered text.

Return value

void Unlike other theme functions, the passed in $image is altered by reference.

See also

_filter_html_image_secure_process()

Related topics

1 theme call to theme_filter_html_image_secure_image()
_filter_html_image_secure_process in drupal/core/modules/filter/filter.module
Process callback for local image filter.

File

drupal/core/modules/filter/filter.module, line 1425
Framework for handling the filtering of content.

Code

function theme_filter_html_image_secure_image(&$variables) {
  $image = $variables['image'];

  // Turn an invalid image into an error indicator.
  $image
    ->setAttribute('src', base_path() . 'core/misc/message-16-error.png');
  $image
    ->setAttribute('alt', t('Image removed.'));
  $image
    ->setAttribute('title', t('This image has been removed. For security reasons, only images from the local domain are allowed.'));

  // Add a CSS class to aid in styling.
  $class = $image
    ->getAttribute('class') ? trim($image
    ->getAttribute('class')) . ' ' : '';
  $class .= 'filter-image-invalid';
  $image
    ->setAttribute('class', $class);
}