You are here

function theme_textimage_background_effect_summary in Textimage 7.3

Renders 'textimage_background' image effect summary.

Implements theme_hook().

Parameters

array $variables: An associative array containing:

  • data: The current configuration of the image effect.

Return value

string The HTML for the summary of the image effect.

File

effects/textimage_background.inc, line 327
Implementation of the 'textimage_background' image effect.

Code

function theme_textimage_background_effect_summary($variables) {
  $output = NULL;

  // Merge input data with effect defaults.
  $data = drupal_array_merge_deep(_textimage_background_effect_defaults(), $variables['data']);
  switch ($data['background_image']['mode']) {
    case 'select':
      $output .= t('- Image: <b>@image</b>', array(
        '@image' => $data['background_image']['uri'],
      ));
      break;
    case 'passthrough':
      $output .= t('- Inherit image from previous effect');
      break;
    case '':
    default:
      $output .= t('- No image');
  }

  // Sizing.
  if ($data['exact']['width'] or $data['exact']['height']) {

    // Exact size.
    $output = $output . ' ' . t('- Exact size:') . ' ';
    if ($data['exact']['width'] and $data['exact']['height']) {
      $output .= t('@wx@h', array(
        '@w' => $data['exact']['width'] ? $data['exact']['width'] : t('src'),
        '@h' => $data['exact']['height'] ? $data['exact']['height'] : t('src'),
      ));
    }
    elseif ($data['exact']['width']) {
      $output .= t('width @w', array(
        '@w' => $data['exact']['width'],
      ));
    }
    else {
      $output .= t('height @h', array(
        '@h' => $data['exact']['height'],
      ));
    }
  }
  elseif ($data['relative']['leftdiff'] or $data['relative']['rightdiff'] or $data['relative']['topdiff'] or $data['relative']['bottomdiff']) {

    // Relative size.
    $output = $output . ' ' . t('- Relative size:') . ' ';
    $output .= $data['relative']['leftdiff'] ? ' ' . t('left: @size', array(
      '@size' => $data['relative']['leftdiff'],
    )) : NULL;
    $output .= $data['relative']['rightdiff'] ? ' ' . t('right: @size', array(
      '@size' => $data['relative']['rightdiff'],
    )) : NULL;
    $output .= $data['relative']['topdiff'] ? ' ' . t('top: @size', array(
      '@size' => $data['relative']['topdiff'],
    )) : NULL;
    $output .= $data['relative']['bottomdiff'] ? ' ' . t('bottom: @size', array(
      '@size' => $data['relative']['bottomdiff'],
    )) : NULL;
  }

  // Color.
  $output .= ' ' . t('- Background color:') . ' ';
  if ($data['background']['color']) {
    $output .= theme('textimage_colored_string', array(
      'text' => 'MMMM',
      'foreground_color' => $data['background']['color'],
      'background_color' => $data['background']['color'],
      'border' => TRUE,
      'border_color' => 'matchLuma',
    ));
  }
  else {
    $output .= ' ' . t('Transparent');
  }
  $background_opacity = _textimage_rgba_to_opacity($data['background']['color']);
  if ($background_opacity != 100) {
    $output .= ', ' . t('opacity: @background_opacity%', array(
      '@background_opacity' => $background_opacity,
    ));
  }
  return $output;
}