function imagecrop_settings in Image javascript crop 5
Same name and namespace in other branches
- 6 imagecrop.admin.inc \imagecrop_settings()
Imagecrop settings page
1 string reference to 'imagecrop_settings'
- imagecrop_menu in ./
imagecrop.module - Implementation of hook_menu().
File
- ./
imagecrop.module, line 52 - Provides a javascript toolbox through an imagecache action.
Code
function imagecrop_settings() {
// hook into image module
if (module_exists('image')) {
$options_modules['image'] = t('Hook into image module');
}
// hook into node_images module
if (module_exists('node_images')) {
$result = db_query("SELECT name,value FROM {variable} WHERE name LIKE 'node_images_position_%'");
if (db_num_rows($result) > 0) {
drupal_set_message(t('When you want to enable support for the node_images module, please read the README that comes with the imagecrop module.'));
while ($row = db_fetch_object($result)) {
if (variable_get($row->name, 'hide') != 'hide') {
$explode = explode('_', $row->name);
$options_modules[$row->name] = t('Hook into node_images module for <em>content type @type</em>', array(
'@type' => $explode[3],
));
}
}
}
}
// hook into imagefield module
if (module_exists('imagefield')) {
$result = db_query("SELECT field_name,label FROM {node_field_instance} WHERE widget_type = 'image'");
while ($row = db_fetch_object($result)) {
$options_fields[$row->field_name] = t('Hook into imagefield %s', array(
'%s' => $row->label,
));
}
}
// show checkboxes if options are not empty
if (!empty($options_modules) || !empty($options_fields)) {
if (!empty($options_modules)) {
$form['imagecrop_modules'] = array(
'#type' => 'checkboxes',
'#title' => t('Hook into modules'),
'#default_value' => variable_get('imagecrop_modules', array()),
'#options' => $options_modules,
);
}
if (!empty($options_fields)) {
$form['imagecrop_fields'] = array(
'#type' => 'checkboxes',
'#title' => t('Hook into cck fields'),
'#default_value' => variable_get('imagecrop_fields', array()),
'#options' => $options_fields,
);
}
$form['array_filter'] = array(
'#type' => 'hidden',
);
}
else {
$form['no_modules_fields'] = array(
'#type' => 'item',
'#value' => t('No modules or fields are found to hook into.'),
);
}
// drupal message if no action is found with javascript_crop
if (imagecrop_action_exists() == FALSE) {
drupal_set_message(t('No preset is found with the javascript_crop action so far. If you want to take advantage of this module, you will need to create at least one preset with that action.'));
}
return system_settings_form($form);
}