You are here

function theme_image_resize_filter_form in Image Resize Filter 7

Same name and namespace in other branches
  1. 6 image_resize_filter.module \theme_image_resize_filter_form()

Theme callback to theme the Image Resize Filter form.

1 theme call to theme_image_resize_filter_form()
image_resize_filter_form in ./image_resize_filter.module
The form for configuring the Image Resize Filter.

File

./image_resize_filter.module, line 179
After adding to a text format, this filter will parse the contents of submitted content and automatically scale image files to match the set dimensions of img tags.

Code

function theme_image_resize_filter_form($variables) {
  $form = $variables['form'];
  $link = 'link';
  $class = 'link_class';
  $rel = 'link_rel';
  $class_element = ' ';
  $class_element .= '<span class="image-resize-filter-class">';
  $class_element .= check_plain($form[$class]['#title']) . ': ';
  $form[$class]['#title'] = NULL;
  $class_element .= drupal_render($form[$class]);
  $class_element .= '</span>';
  $rel_element = ' ';
  $rel_element .= '<span class="image-resize-filter-rel">';
  $rel_element .= check_plain($form[$rel]['#title']) . ': ';
  $form[$rel]['#title'] = NULL;
  $rel_element .= drupal_render($form[$rel]);
  $rel_element .= '</span>';
  $link_element = drupal_render($form[$link]);
  $output = '';
  $output .= '<div class="container-inline image-resize-filter-link-options">';
  $output .= $link_element;
  $output .= $class_element;
  $output .= $rel_element;
  $output .= '</div>';
  $form['placeholder'] = array(
    '#type' => 'element',
    '#title' => t('Link to the original'),
    '#title_display' => 'before',
    '#children' => $output,
    '#description' => t('Linking to the original can be helpful to give users a full-size view of the image. Adding the class "thickbox" is helpful if you have installed the <a href="http://drupal.org/project/thickbox">thickbox module</a>. The rel attribute may be useful when used with the <a href="http://drupal.org/project/lightbox2">lightbox2</a> and <a href="http://drupal.org/project/shadowbox">shadowbox</a> modules.'),
  );

  // Add a little bit of JavaScript. Not cached since it's only used here.
  drupal_add_js(drupal_get_path('module', 'image_resize_filter') . '/image_resize_filter.js', array(
    'aggregate' => FALSE,
  ));
  return filter_xss_admin($form['#description']) . drupal_render_children($form);
}