diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 80563ef..d194319 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -218,12 +218,16 @@ define('LANGUAGE_RTL', 1); define('REQUEST_TIME', (int) $_SERVER['REQUEST_TIME']); /** - * Flag for drupal_set_title(); text is not sanitized, so run check_plain(). + * Flag used to indicate that text is not sanitized, so run check_plain(). + * + * @see drupal_set_title() */ define('CHECK_PLAIN', 0); /** - * Flag for drupal_set_title(); text has already been sanitized. + * Flag used to indicate that text has already been sanitized. + * + * @see drupal_set_title() */ define('PASS_THROUGH', -1); diff --git a/modules/image/image.admin.inc b/modules/image/image.admin.inc index 9f0fab2..7e62621 100644 --- a/modules/image/image.admin.inc +++ b/modules/image/image.admin.inc @@ -32,10 +32,9 @@ function image_style_list() { * An image style array. * @ingroup forms * @see image_style_form_submit() - * @see image_style_name_validate() */ function image_style_form($form, &$form_state, $style) { - $title = t('Edit %name style', array('%name' => $style['name'])); + $title = t('Edit %name style', array('%name' => $style['label'])); drupal_set_title($title, PASS_THROUGH); // Adjust this form for styles that must be overridden to edit. @@ -56,27 +55,31 @@ function image_style_form($form, &$form_state, $style) { '#markup' => theme('image_style_preview', array('style' => $style)), ); + // Show the Image Style label. + $form['label'] = array( + '#type' => 'textfield', + '#title' => t('Image style name'), + '#default_value' => $style['label'], + '#disabled' => !$editable, + '#required' => TRUE, + ); + // Allow the name of the style to be changed, unless this style is // provided by a module's hook_default_image_styles(). - if ($style['storage'] & IMAGE_STORAGE_MODULE) { - $form['name'] = array( - '#type' => 'item', - '#title' => t('Image style name'), - '#markup' => $style['name'], - '#description' => t('This image style is being provided by %module module and may not be renamed.', array('%module' => $style['module'])), - ); - } - else { - $form['name'] = array( - '#type' => 'textfield', - '#size' => '64', - '#title' => t('Image style name'), - '#default_value' => $style['name'], - '#description' => t('The name is used in URLs for generated images. Use only lowercase alphanumeric characters, underscores (_), and hyphens (-).'), - '#element_validate' => array('image_style_name_validate'), - '#required' => TRUE, - ); - } + $form['name'] = array( + '#type' => 'machine_name', + '#size' => '64', + '#default_value' => $style['name'], + '#disabled' => !$editable, + '#description' => t('The name is used in URLs for generated images. Use only lowercase alphanumeric characters, underscores (_), and hyphens (-).'), + '#required' => TRUE, + '#machine_name' => array( + 'exists' => 'image_style_load', + 'source' => array('label'), + 'replace_pattern' => '[^0-9a-z_\-]', + 'error' => t('Please only use lowercase alphanumeric characters, underscores (_), and hyphens (-) for style names.'), + ), + ); // Build the list of existing image effects for this image style. $form['effects'] = array( @@ -199,7 +202,7 @@ function image_style_form_add_submit($form, &$form_state) { * Submit handler for overriding a module-defined style. */ function image_style_form_override_submit($form, &$form_state) { - drupal_set_message(t('The %style style has been overridden, allowing you to change its settings.', array('%style' => $form_state['image_style']['name']))); + drupal_set_message(t('The %style style has been overridden, allowing you to change its settings.', array('%style' => $form_state['image_style']['label']))); image_default_style_save($form_state['image_style']); } @@ -207,11 +210,10 @@ function image_style_form_override_submit($form, &$form_state) { * Submit handler for saving an image style. */ function image_style_form_submit($form, &$form_state) { - // Update the image style name if it has changed. + // Update the image style. $style = $form_state['image_style']; - if (isset($form_state['values']['name']) && $style['name'] != $form_state['values']['name']) { - $style['name'] = $form_state['values']['name']; - } + $style['name'] = $form_state['values']['name']; + $style['label'] = $form_state['values']['label']; // Update image effect weights. if (!empty($form_state['values']['effects'])) { @@ -236,17 +238,25 @@ function image_style_form_submit($form, &$form_state) { * * @ingroup forms * @see image_style_add_form_submit() - * @see image_style_name_validate() */ function image_style_add_form($form, &$form_state) { - $form['name'] = array( + $form['label'] = array( '#type' => 'textfield', - '#size' => '64', '#title' => t('Style name'), '#default_value' => '', + '#required' => TRUE, + ); + $form['name'] = array( + '#type' => 'machine_name', '#description' => t('The name is used in URLs for generated images. Use only lowercase alphanumeric characters, underscores (_), and hyphens (-).'), - '#element_validate' => array('image_style_name_validate'), + '#size' => '64', '#required' => TRUE, + '#machine_name' => array( + 'exists' => 'image_style_load', + 'source' => array('label'), + 'replace_pattern' => '[^0-9a-z_\-]', + 'error' => t('Please only use lowercase alphanumeric characters, underscores (_), and hyphens (-) for style names.'), + ), ); $form['submit'] = array( @@ -261,14 +271,22 @@ function image_style_add_form($form, &$form_state) { * Submit handler for adding a new image style. */ function image_style_add_form_submit($form, &$form_state) { - $style = array('name' => $form_state['values']['name']); + $style = array( + 'name' => $form_state['values']['name'], + 'label' => $form_state['values']['label'], + ); $style = image_style_save($style); - drupal_set_message(t('Style %name was created.', array('%name' => $style['name']))); + drupal_set_message(t('Style %name was created.', array('%name' => $style['label']))); $form_state['redirect'] = 'admin/config/media/image-styles/edit/' . $style['name']; } /** * Element validate function to ensure unique, URL safe style names. + * + * This function is no longer used in Drupal core since image style names are + * now validated using #machine_name functionality. It is kept for backwards + * compatibility (since non-core modules may be using it) and will be removed + * in Drupal 8. */ function image_style_name_validate($element, $form_state) { // Check for duplicates. @@ -295,7 +313,7 @@ function image_style_name_validate($element, $form_state) { function image_style_delete_form($form, &$form_state, $style) { $form_state['image_style'] = $style; - $replacement_styles = array_diff_key(image_style_options(), array($style['name'] => '')); + $replacement_styles = array_diff_key(image_style_options(TRUE, PASS_THROUGH), array($style['name'] => '')); $form['replacement'] = array( '#title' => t('Replacement style'), '#type' => 'select', @@ -305,7 +323,7 @@ function image_style_delete_form($form, &$form_state, $style) { return confirm_form( $form, - t('Optionally select a style before deleting %style', array('%style' => $style['name'])), + t('Optionally select a style before deleting %style', array('%style' => $style['label'])), 'admin/config/media/image-styles', t('If this style is in use on the site, you may select another style to replace it. All images that have been generated for this style will be permanently deleted.'), t('Delete'), t('Cancel') @@ -319,7 +337,7 @@ function image_style_delete_form_submit($form, &$form_state) { $style = $form_state['image_style']; image_style_delete($style, $form_state['values']['replacement']); - drupal_set_message(t('Style %name was deleted.', array('%name' => $style['name']))); + drupal_set_message(t('Style %name was deleted.', array('%name' => $style['label']))); $form_state['redirect'] = 'admin/config/media/image-styles'; } @@ -331,7 +349,7 @@ function image_style_revert_form($form, &$form_state, $style) { return confirm_form( $form, - t('Revert the %style style?', array('%style' => $style['name'])), + t('Revert the %style style?', array('%style' => $style['label'])), 'admin/config/media/image-styles', t('Reverting this style will delete the customized settings and restore the defaults provided by the @module module.', array('@module' => $style['module'])), t('Revert'), t('Cancel') @@ -342,7 +360,7 @@ function image_style_revert_form($form, &$form_state, $style) { * Submit handler to convert an overridden style to its default. */ function image_style_revert_form_submit($form, &$form_state) { - drupal_set_message(t('The %style style has been reverted to its defaults.', array('%style' => $form_state['image_style']['name']))); + drupal_set_message(t('The %style style has been reverted to its defaults.', array('%style' => $form_state['image_style']['label']))); image_default_style_revert($form_state['image_style']); $form_state['redirect'] = 'admin/config/media/image-styles'; } @@ -439,7 +457,7 @@ function image_effect_delete_form($form, &$form_state, $style, $effect) { $form_state['image_style'] = $style; $form_state['image_effect'] = $effect; - $question = t('Are you sure you want to delete the @effect effect from the %style style?', array('%style' => $style['name'], '@effect' => $effect['label'])); + $question = t('Are you sure you want to delete the @effect effect from the %style style?', array('%style' => $style['label'], '@effect' => $effect['label'])); return confirm_form($form, $question, 'admin/config/media/image-styles/edit/' . $style['name'], '', t('Delete')); } @@ -650,7 +668,7 @@ function theme_image_style_list($variables) { $rows = array(); foreach ($styles as $style) { $row = array(); - $row[] = l($style['name'], 'admin/config/media/image-styles/edit/' . $style['name']); + $row[] = l($style['label'], 'admin/config/media/image-styles/edit/' . $style['name']); $link_attributes = array( 'attributes' => array( 'class' => array('image-style-link'), @@ -805,7 +823,7 @@ function theme_image_style_preview($variables) { // Build the preview of the image style. $preview_url = file_create_url($preview_file) . '?cache_bypass=' . REQUEST_TIME; $output .= '
'; - $output .= check_plain($style['name']) . ' (' . l(t('view actual size'), file_create_url($preview_file) . '?' . time()) . ')'; + $output .= check_plain($style['label']) . ' (' . l(t('view actual size'), file_create_url($preview_file) . '?' . time()) . ')'; $output .= '
'; $output .= '' . theme('image', array('path' => $preview_url, 'alt' => t('Sample modified image'), 'title' => '', 'attributes' => $preview_attributes)) . ''; $output .= '
' . $preview_image['height'] . 'px
'; diff --git a/modules/image/image.api.php b/modules/image/image.api.php index 1cb2b0d..8115116 100644 --- a/modules/image/image.api.php +++ b/modules/image/image.api.php @@ -177,6 +177,7 @@ function hook_image_default_styles() { $styles = array(); $styles['mymodule_preview'] = array( + 'label' => 'My module preview', 'effects' => array( array( 'name' => 'image_scale', diff --git a/modules/image/image.field.inc b/modules/image/image.field.inc index 60c0f5a..2354738 100644 --- a/modules/image/image.field.inc +++ b/modules/image/image.field.inc @@ -311,7 +311,7 @@ function image_field_widget_settings_form($field, $instance) { $form['preview_image_style'] = array( '#title' => t('Preview image style'), '#type' => 'select', - '#options' => image_style_options(FALSE), + '#options' => image_style_options(FALSE, PASS_THROUGH), '#empty_option' => '<' . t('no preview') . '>', '#default_value' => $settings['preview_image_style'], '#description' => t('The preview image will be shown while editing the content.'), @@ -495,7 +495,7 @@ function image_field_formatter_settings_form($field, $instance, $view_mode, $for $display = $instance['display'][$view_mode]; $settings = $display['settings']; - $image_styles = image_style_options(FALSE); + $image_styles = image_style_options(FALSE, PASS_THROUGH); $element['image_style'] = array( '#title' => t('Image style'), '#type' => 'select', @@ -528,7 +528,7 @@ function image_field_formatter_settings_summary($field, $instance, $view_mode) { $summary = array(); - $image_styles = image_style_options(FALSE); + $image_styles = image_style_options(FALSE, PASS_THROUGH); // Unset possible 'No defined styles' option. unset($image_styles['']); // Styles could be lost because of enabled/disabled modules that defines diff --git a/modules/image/image.install b/modules/image/image.install index 1d7bd4e..45bcbbb 100644 --- a/modules/image/image.install +++ b/modules/image/image.install @@ -41,11 +41,18 @@ function image_schema() { 'not null' => TRUE, ), 'name' => array( - 'description' => 'The style name.', + 'description' => 'The style machine name.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, ), + 'label' => array( + 'description' => 'The style administrative name.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), ), 'primary key' => array('isid'), 'unique keys' => array( @@ -449,6 +456,30 @@ function image_update_7004() { } /** + * Add a column to the 'image_style' table to store administrative labels. + */ +function image_update_7005() { + $field = array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'The style administrative name.', + ); + db_add_field('image_styles', 'label', $field); + + // Do a direct query here, rather than calling image_styles(), + // in case Image module is disabled. + $styles = db_query('SELECT name FROM {image_styles}')->fetchCol(); + foreach ($styles as $style) { + db_update('image_styles') + ->fields(array('label' => $style)) + ->condition('name', $style) + ->execute(); + } +} + +/** * @} End of "addtogroup updates-7.x-extra". */ diff --git a/modules/image/image.module b/modules/image/image.module index b7d6cdd..fcbf62c 100644 --- a/modules/image/image.module +++ b/modules/image/image.module @@ -347,6 +347,7 @@ function image_image_default_styles() { $styles = array(); $styles['thumbnail'] = array( + 'label' => 'Thumbnail (100x100)', 'effects' => array( array( 'name' => 'image_scale', @@ -357,6 +358,7 @@ function image_image_default_styles() { ); $styles['medium'] = array( + 'label' => 'Medium (220x220)', 'effects' => array( array( 'name' => 'image_scale', @@ -367,6 +369,7 @@ function image_image_default_styles() { ); $styles['large'] = array( + 'label' => 'Large (480x480)', 'effects' => array( array( 'name' => 'image_scale', @@ -575,6 +578,7 @@ function image_styles() { $module_styles = module_invoke($module, 'image_default_styles'); foreach ($module_styles as $style_name => $style) { $style['name'] = $style_name; + $style['label'] = empty($style['label']) ? $style_name : $style['label']; $style['module'] = $module; $style['storage'] = IMAGE_STORAGE_DEFAULT; foreach ($style['effects'] as $key => $effect) { @@ -689,6 +693,10 @@ function image_style_save($style) { } } else { + // Add a default label when not given. + if (empty($style['label'])) { + $style['label'] = $style['name']; + } drupal_write_record('image_styles', $style); $style['is_new'] = TRUE; } @@ -758,20 +766,28 @@ function image_style_effects($style) { * * @param $include_empty * If TRUE a option will be inserted in the options array. + * @param $output + * Optional flag determining how the options will be sanitized on output. + * Leave this at the default (CHECK_PLAIN) if you are using the output of + * this function directly in an HTML context, such as for checkbox or radio + * button labels, and do not plan to sanitize it on your own. If using the + * output of this function as select list options (its primary use case), you + * should instead set this flag to PASS_THROUGH to avoid double-escaping of + * the output (the form API sanitizes select list options by default). * * @return - * Array of image styles both key and value are set to style name. + * Array of image styles with the machine name as key and the label as value. */ -function image_style_options($include_empty = TRUE) { +function image_style_options($include_empty = TRUE, $output = CHECK_PLAIN) { $styles = image_styles(); $options = array(); if ($include_empty && !empty($styles)) { $options[''] = t(''); } - // Use the array concatenation operator '+' here instead of array_merge(), - // because the latter loses the datatype of the array keys, turning - // associative string keys into numeric ones without warning. - $options = $options + drupal_map_assoc(array_keys($styles)); + foreach ($styles as $name => $style) { + $options[$name] = ($output == PASS_THROUGH) ? $style['label'] : check_plain($style['label']); + } + if (empty($options)) { $options[''] = t('No defined styles'); } diff --git a/modules/image/image.test b/modules/image/image.test index 0a3ab50..59fc77d 100644 --- a/modules/image/image.test +++ b/modules/image/image.test @@ -122,7 +122,7 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase { parent::setUp('image_module_test'); $this->style_name = 'style_foo'; - image_style_save(array('name' => $this->style_name)); + image_style_save(array('name' => $this->style_name, 'label' => $this->randomString())); } /** @@ -484,11 +484,13 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { */ function testNumericStyleName() { $style_name = rand(); + $style_label = $this->randomString(); $edit = array( 'name' => $style_name, + 'label' => $style_label, ); $this->drupalPost('admin/config/media/image-styles/add', $edit, t('Create new style')); - $this->assertRaw(t('Style %name was created.', array('%name' => $style_name)), 'Image style successfully created.'); + $this->assertRaw(t('Style %name was created.', array('%name' => $style_label)), 'Image style successfully created.'); $options = image_style_options(); $this->assertTrue(array_key_exists($style_name, $options), format_string('Array key %key exists.', array('%key' => $style_name))); } @@ -499,6 +501,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { function testStyle() { // Setup a style to be created and effects to add to it. $style_name = strtolower($this->randomName(10)); + $style_label = $this->randomString(); $style_path = 'admin/config/media/image-styles/edit/' . $style_name; $effect_edits = array( 'image_resize' => array( @@ -533,9 +536,10 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { $edit = array( 'name' => $style_name, + 'label' => $style_label, ); $this->drupalPost('admin/config/media/image-styles/add', $edit, t('Create new style')); - $this->assertRaw(t('Style %name was created.', array('%name' => $style_name)), 'Image style successfully created.'); + $this->assertRaw(t('Style %name was created.', array('%name' => $style_label)), 'Image style successfully created.'); // Add effect form. @@ -578,9 +582,11 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { // Test the style overview form. // Change the name of the style and adjust the weights of effects. $style_name = strtolower($this->randomName(10)); + $style_label = $this->randomString(); $weight = count($effect_edits); $edit = array( 'name' => $style_name, + 'label' => $style_label, ); foreach ($style['effects'] as $ieid => $effect) { $edit['effects[' . $ieid . '][weight]'] = $weight; @@ -589,7 +595,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { // Create an image to make sure it gets flushed after saving. $image_path = $this->createSampleImage($style); - $this->assertEqual($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path))); + $this->assertEqual($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', array('%style' => $style['label'], '%file' => $image_path))); $this->drupalPost($style_path, $edit, t('Update style')); @@ -598,12 +604,12 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { // Check that the URL was updated. $this->drupalGet($style_path); - $this->assertResponse(200, format_string('Image style %original renamed to %new', array('%original' => $style['name'], '%new' => $style_name))); + $this->assertResponse(200, format_string('Image style %original renamed to %new', array('%original' => $style['label'], '%new' => $style_label))); // Check that the image was flushed after updating the style. // This is especially important when renaming the style. Make sure that // the old image directory has been deleted. - $this->assertEqual($this->getImageCount($style), 0, format_string('Image style %style was flushed after renaming the style and updating the order of effects.', array('%style' => $style['name']))); + $this->assertEqual($this->getImageCount($style), 0, format_string('Image style %style was flushed after renaming the style and updating the order of effects.', array('%style' => $style['label']))); // Load the style by the new name with the new weights. drupal_static_reset('image_styles'); @@ -624,7 +630,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { // Create an image to make sure it gets flushed after deleting an effect. $image_path = $this->createSampleImage($style); - $this->assertEqual($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path))); + $this->assertEqual($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', array('%style' => $style['label'], '%file' => $image_path))); // Test effect deletion form. $effect = array_pop($style['effects']); @@ -638,10 +644,10 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { // Confirm the style directory has been removed. $directory = file_default_scheme() . '://styles/' . $style_name; - $this->assertFalse(is_dir($directory), format_string('Image style %style directory removed on style deletion.', array('%style' => $style['name']))); + $this->assertFalse(is_dir($directory), format_string('Image style %style directory removed on style deletion.', array('%style' => $style['label']))); drupal_static_reset('image_styles'); - $this->assertFalse(image_style_load($style_name), format_string('Image style %style successfully deleted.', array('%style' => $style['name']))); + $this->assertFalse(image_style_load($style_name), format_string('Image style %style successfully deleted.', array('%style' => $style['label']))); } @@ -651,6 +657,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { function testDefaultStyle() { // Setup a style to be created and effects to add to it. $style_name = 'thumbnail'; + $style_label = 'Thumbnail (100x100)'; $edit_path = 'admin/config/media/image-styles/edit/' . $style_name; $delete_path = 'admin/config/media/image-styles/delete/' . $style_name; $revert_path = 'admin/config/media/image-styles/revert/' . $style_name; @@ -661,7 +668,8 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { // Ensure that editing a default is not possible (without overriding). $this->drupalGet($edit_path); - $this->assertNoField('edit-name', 'Default styles may not be renamed.'); + $disabled_field = $this->xpath('//input[@id=:id and @disabled="disabled"]', array(':id' => 'edit-name')); + $this->assertTrue($disabled_field, 'Default styles may not be renamed.'); $this->assertNoField('edit-submit', 'Default styles may not be edited.'); $this->assertNoField('edit-add', 'Default styles may not have new effects added.'); @@ -678,7 +686,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { // Override the default. $this->drupalPost($edit_path, array(), t('Override defaults')); - $this->assertRaw(t('The %style style has been overridden, allowing you to change its settings.', array('%style' => $style_name)), 'Default image style may be overridden.'); + $this->assertRaw(t('The %style style has been overridden, allowing you to change its settings.', array('%style' => $style_label)), 'Default image style may be overridden.'); // Add sample effect to the overridden style. $this->drupalPost($edit_path, array('new' => 'image_desaturate'), t('Add')); @@ -696,13 +704,14 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { $this->assertEqual($effects[0]['name'], 'image_scale', 'The default effect still exists in the overridden style.'); $this->assertEqual($effects[1]['name'], 'image_desaturate', 'The added effect exists in the overridden style.'); - // Check that we are unable to rename an overridden style. + // Check that we are able to rename an overridden style. $this->drupalGet($edit_path); - $this->assertNoField('edit-name', 'Overridden styles may not be renamed.'); + $disabled_field = $this->xpath('//input[@id=:id and @disabled="disabled"]', array(':id' => 'edit-name')); + $this->assertFalse($disabled_field, 'Overridden styles may be renamed.'); // Create an image to ensure the override works properly. $image_path = $this->createSampleImage($style); - $this->assertEqual($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path))); + $this->assertEqual($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', array('%style' => $style['label'], '%file' => $image_path))); // Revert the image style. $this->drupalPost($revert_path, array(), t('Revert')); @@ -721,7 +730,8 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { function testStyleReplacement() { // Create a new style. $style_name = strtolower($this->randomName(10)); - image_style_save(array('name' => $style_name)); + $style_label = $this->randomString(); + image_style_save(array('name' => $style_name, 'label' => $style_label)); $style_path = 'admin/config/media/image-styles/edit/' . $style_name; // Create an image field that uses the new style. @@ -743,8 +753,10 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { // Rename the style and make sure the image field is updated. $new_style_name = strtolower($this->randomName(10)); + $new_style_label = $this->randomString(); $edit = array( 'name' => $new_style_name, + 'label' => $new_style_label, ); $this->drupalPost('admin/config/media/image-styles/edit/' . $style_name, $edit, t('Update style')); $this->assertText(t('Changes to the style have been saved.'), format_string('Style %name was renamed to %new_name.', array('%name' => $style_name, '%new_name' => $new_style_name))); @@ -756,7 +768,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase { 'replacement' => 'thumbnail', ); $this->drupalPost('admin/config/media/image-styles/delete/' . $new_style_name, $edit, t('Delete')); - $message = t('Style %name was deleted.', array('%name' => $new_style_name)); + $message = t('Style %name was deleted.', array('%name' => $new_style_label)); $this->assertRaw($message, $message); $this->drupalGet('node/' . $nid); @@ -1116,7 +1128,7 @@ class ImageDimensionsTestCase extends DrupalWebTestCase { $original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME); // Create a style. - $style = image_style_save(array('name' => 'test')); + $style = image_style_save(array('name' => 'test', 'label' => 'Test')); $generated_uri = 'public://styles/test/public/'. drupal_basename($original_uri); $url = image_style_url('test', $original_uri); @@ -1704,7 +1716,7 @@ class ImageThemeFunctionWebTestCase extends DrupalWebTestCase { $original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME); // Create a style. - image_style_save(array('name' => 'test')); + image_style_save(array('name' => 'test', 'label' => 'Test')); $url = image_style_url('test', $original_uri); // Test using theme_image_formatter() without an image title, alt text, or diff --git a/modules/user/user.admin.inc b/modules/user/user.admin.inc index 932c205..6ca330b 100644 --- a/modules/user/user.admin.inc +++ b/modules/user/user.admin.inc @@ -406,7 +406,7 @@ function user_admin_settings() { $form['personalization']['pictures']['settings']['user_picture_style'] = array( '#type' => 'select', '#title' => t('Picture display style'), - '#options' => image_style_options(TRUE), + '#options' => image_style_options(TRUE, PASS_THROUGH), '#default_value' => variable_get('user_picture_style', ''), '#description' => t('The style selected will be used on display, while the original image is retained. Styles may be configured in the Image styles administration area.', array('!url' => url('admin/config/media/image-styles'))), );