function theme_image_style_effects

Returns HTML for a listing of the effects within a specific image style.

Parameters

$variables: An associative array containing:

  • form: A render element representing the form.

Related topics

1 theme call to theme_image_style_effects()
image_style_form in drupal/core/modules/image/image.admin.inc
Form builder; Edit an image style name and effects order.

File

drupal/core/modules/image/image.admin.inc, line 559
Administration pages for image settings.

Code

function theme_image_style_effects($variables) {
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form) as $key) {
    $row = array();
    $form[$key]['weight']['#attributes']['class'] = array(
      'image-effect-order-weight',
    );
    if ($key != 'new') {
      $summary = drupal_render($form[$key]['summary']);
      $row[] = drupal_render($form[$key]['label']) . (empty($summary) ? '' : ' ' . $summary);
      $row[] = drupal_render($form[$key]['weight']);
      $row[] = array(
        'data' => $form[$key]['operations'],
      );
    }
    else {

      // Add the row for adding a new image effect.
      $row[] = '<div class="image-style-new">' . drupal_render($form['new']['new']) . drupal_render($form['new']['add']) . '</div>';
      $row[] = drupal_render($form['new']['weight']);
      $row[] = '';
    }
    $rows[] = array(
      'data' => $row,
      'class' => array(
        'draggable',
      ),
    );
  }
  $header = array(
    t('Effect'),
    t('Weight'),
    t('Operations'),
  );
  if (count($rows) == 1 && (!isset($form['new']['#access']) || $form['new']['#access'])) {
    array_unshift($rows, array(
      array(
        'data' => t('There are currently no effects in this style. Add one by selecting an option below.'),
        'colspan' => 4,
      ),
    ));
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'image-style-effects',
    ),
  ));
  drupal_add_tabledrag('image-style-effects', 'order', 'sibling', 'image-effect-order-weight');
  return $output;
}