Hi,

this task is just a suggestion to code improvement.

Argument !url in first line of instructions in hook_help() should be a url() wrapped as follows:

array('!url' => url('admin/config/content/formats'))

Also, I believe there's no need in image_resize_filter_form theme since the form could be written as follows:

function image_resize_filter_form($form, &$form_state, $filter, $format, $defaults) {
  $filter->settings += $defaults;

  $settings['image_resize'] = array(
    '#prefix' => '<p>',
    '#markup' => t('The image resize filter will analyze &lt;img&gt; tags and compare the given height and width attributes to the actual file. If the file dimensions are different than those given in the &lt;img&gt; tag, the image will be copied and the src attribute will be updated to point to the resized image.'),
    '#suffix' => '</p>'
  );

  $settings['image_locations'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Resize images stored'),
    '#options' => array(
      'local' => t('Locally'),
      'remote' => t('On remote servers (note: this copies <em>all</em> remote images locally)')
    ),
    '#default_value' => $filter->settings['image_locations'],
    '#description' => t('This option will determine which images will be analyzed for &lt;img&gt; tag differences. Enabling resizing of remote images can have performance impacts, as all images in the filtered text needs to be transfered via HTTP each time the filter cache is cleared.')
  );

  $settings['link'] = array(
    '#type' => 'checkbox',
    '#title' => t('If resized, add a link to the original image.'),
    '#default_value' => $filter->settings['link']
  );

  $states = array(
    'visible' => array(
      ':input[name="filters[image_resize_filter][settings][link]"]' => array(
        'checked' => TRUE
      )
    )
  );
  $settings['link_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Link class'),
    '#default_value' => $filter->settings['link_class'],
    '#states' => $states,
    '#size' => 10
  );

  $settings['link_rel'] = array(
    '#type' => 'textfield',
    '#title' => t('Link rel attribute'),
    '#default_value' => $filter->settings['link_rel'],
    '#states' => $states,
    '#size' => 10
  );

  return $settings;
}

Of cause after that we don't need theme_image_resize_filter_form() function as well as image_resize_filter.js because we included $states to our elements which should be hidden when link is ticked off.

Hope this will help.

Comments

quicksketch’s picture

Thanks. The theming and JS files is left over from the D6 version and is maintained that way while we still support D6 as it makes patches easier to apply between versions..

Vlad Stratulat’s picture

Isn't it easier to write code specific to each version of Drupal? In this case less "trash code" would be in modules.

quicksketch’s picture

If you're keeping modules synced between D6 and D7, similar code is much easier to manage. If I write D7-specific features, then I would branch the project for a new version entirely, that's when all the extra code gets trimmed out.

ram4nd’s picture

Version: 7.x-1.13 » 7.x-1.x-dev
Issue summary: View changes
Status: Needs review » Needs work
Issue tags: -improvement

Create a patch please, against the latest dev.