Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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 <img> tags and compare the given height and width attributes to the actual file. If the file dimensions are different than those given in the <img> 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 <img> 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
Comment #1
quicksketchThanks. 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..
Comment #2
Vlad Stratulat CreditAttribution: Vlad Stratulat commentedIsn't it easier to write code specific to each version of Drupal? In this case less "trash code" would be in modules.
Comment #3
quicksketchIf 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.
Comment #4
ram4nd CreditAttribution: ram4nd as a volunteer commentedCreate a patch please, against the latest dev.