You are here

function theme_image_desaturate_formatter in Image desaturate formatter 8

Same name and namespace in other branches
  1. 7.2 image_desaturate_formatter.module \theme_image_desaturate_formatter()
  2. 7 image_desaturate_formatter.module \theme_image_desaturate_formatter()

Returns HTML for an image_desaturate field formatter.

Parameters

array $variables: An associative array containing:

  • item: An array of image data.
  • image_style: An optional image style.
  • path: An optional array containing the link 'path' and link 'options'.
  • default_style: An optional image color style

File

./image_desaturate_formatter.module, line 34
Code for the Image desaturate formatter module.

Code

function theme_image_desaturate_formatter($variables) {
  $variables['item']['attributes'] = array(
    'class' => array(
      $variables['default_style'] == 'desaturate' ? 'desaturate-formatter' : 'no-desaturate-formatter',
    ),
  );
  $render = array(
    '#theme' => 'image_formatter',
    '#item' => $variables['item'],
    '#image_style' => $variables['image_style'],
    '#path' => $variables['path'],
    '#attached' => array(
      'css' => array(
        drupal_get_path('module', 'image_desaturate_formatter') . '/library/image_desaturate_formatter.css',
      ),
    ),
  );
  return drupal_render($render);
}