Issue #1025796 by jthorson, Rob Loach, tim.plunkett, alex_ustinov: Fixed Rename path to uri in image functions.
parent
2517db019f
commit
1b4dfed494
|
@ -6559,7 +6559,7 @@ function drupal_common_theme() {
|
|||
// - http://dev.w3.org/html5/spec/Overview.html#alt
|
||||
// The title attribute is optional in all cases, so it is omitted by
|
||||
// default.
|
||||
'variables' => array('path' => NULL, 'width' => NULL, 'height' => NULL, 'alt' => '', 'title' => NULL, 'attributes' => array()),
|
||||
'variables' => array('uri' => NULL, 'width' => NULL, 'height' => NULL, 'alt' => '', 'title' => NULL, 'attributes' => array()),
|
||||
),
|
||||
'breadcrumb' => array(
|
||||
'variables' => array('breadcrumb' => NULL),
|
||||
|
|
|
@ -1638,7 +1638,7 @@ function theme_links($variables) {
|
|||
*
|
||||
* @param $variables
|
||||
* An associative array containing:
|
||||
* - path: Either the path of the image file (relative to base_path()) or a
|
||||
* - uri: Either the path of the image file (relative to base_path()) or a
|
||||
* full URL.
|
||||
* - width: The width of the image (if known).
|
||||
* - height: The height of the image (if known).
|
||||
|
@ -1658,10 +1658,9 @@ function theme_links($variables) {
|
|||
*/
|
||||
function theme_image($variables) {
|
||||
$attributes = $variables['attributes'];
|
||||
$attributes['src'] = file_create_url($variables['path']);
|
||||
$attributes['src'] = file_create_url($variables['uri']);
|
||||
|
||||
foreach (array('width', 'height', 'alt', 'title') as $key) {
|
||||
|
||||
if (isset($variables[$key])) {
|
||||
$attributes[$key] = $variables[$key];
|
||||
}
|
||||
|
@ -1909,10 +1908,10 @@ function theme_table($variables) {
|
|||
*/
|
||||
function theme_tablesort_indicator($variables) {
|
||||
if ($variables['style'] == "asc") {
|
||||
return theme('image', array('path' => 'core/misc/arrow-asc.png', 'width' => 13, 'height' => 13, 'alt' => t('sort ascending'), 'title' => t('sort ascending')));
|
||||
return theme('image', array('uri' => 'core/misc/arrow-asc.png', 'width' => 13, 'height' => 13, 'alt' => t('sort ascending'), 'title' => t('sort ascending')));
|
||||
}
|
||||
else {
|
||||
return theme('image', array('path' => 'core/misc/arrow-desc.png', 'width' => 13, 'height' => 13, 'alt' => t('sort descending'), 'title' => t('sort descending')));
|
||||
return theme('image', array('uri' => 'core/misc/arrow-desc.png', 'width' => 13, 'height' => 13, 'alt' => t('sort descending'), 'title' => t('sort descending')));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2046,7 +2045,7 @@ function theme_more_help_link($variables) {
|
|||
*/
|
||||
function theme_feed_icon($variables) {
|
||||
$text = t('Subscribe to @feed-title', array('@feed-title' => $variables['title']));
|
||||
if ($image = theme('image', array('path' => 'core/misc/feed.png', 'width' => 16, 'height' => 16, 'alt' => $text))) {
|
||||
if ($image = theme('image', array('uri' => 'core/misc/feed.png', 'width' => 16, 'height' => 16, 'alt' => $text))) {
|
||||
return l($image, $variables['url'], array('html' => TRUE, 'attributes' => array('class' => array('feed-icon'), 'title' => $text)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ function _color_theme_select_form_alter(&$form, &$form_state) {
|
|||
foreach (element_children($form) as $theme) {
|
||||
if ($screenshot = variable_get('color_' . $theme . '_screenshot')) {
|
||||
if (isset($form[$theme]['screenshot'])) {
|
||||
$form[$theme]['screenshot']['#markup'] = theme('image', array('path' => $screenshot, 'title' => '', 'attributes' => array('class' => array('screenshot'))));
|
||||
$form[$theme]['screenshot']['#markup'] = theme('image', array('uri' => $screenshot, 'title' => '', 'attributes' => array('class' => array('screenshot'))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -796,7 +796,7 @@ function theme_image_style_preview($variables) {
|
|||
$output .= '<div class="preview-image-wrapper">';
|
||||
$output .= t('original') . ' (' . l(t('view actual size'), $original_url) . ')';
|
||||
$output .= '<div class="preview-image original-image" style="' . $original_attributes['style'] . '">';
|
||||
$output .= '<a href="' . $original_url . '">' . theme('image', array('path' => $original_path, 'alt' => t('Sample original image'), 'title' => '', 'attributes' => $original_attributes)) . '</a>';
|
||||
$output .= '<a href="' . $original_url . '">' . theme('image', array('uri' => $original_path, 'alt' => t('Sample original image'), 'title' => '', 'attributes' => $original_attributes)) . '</a>';
|
||||
$output .= '<div class="height" style="height: ' . $original_height . 'px"><span>' . $original_image['height'] . 'px</span></div>';
|
||||
$output .= '<div class="width" style="width: ' . $original_width . 'px"><span>' . $original_image['width'] . 'px</span></div>';
|
||||
$output .= '</div>'; // End preview-image.
|
||||
|
@ -807,7 +807,7 @@ function theme_image_style_preview($variables) {
|
|||
$output .= '<div class="preview-image-wrapper">';
|
||||
$output .= check_plain($style['name']) . ' (' . l(t('view actual size'), file_create_url($preview_file) . '?' . time()) . ')';
|
||||
$output .= '<div class="preview-image modified-image" style="' . $preview_attributes['style'] . '">';
|
||||
$output .= '<a href="' . file_create_url($preview_file) . '?' . time() . '">' . theme('image', array('path' => $preview_url, 'alt' => t('Sample modified image'), 'title' => '', 'attributes' => $preview_attributes)) . '</a>';
|
||||
$output .= '<a href="' . file_create_url($preview_file) . '?' . time() . '">' . theme('image', array('uri' => $preview_url, 'alt' => t('Sample modified image'), 'title' => '', 'attributes' => $preview_attributes)) . '</a>';
|
||||
$output .= '<div class="height" style="height: ' . $preview_height . 'px"><span>' . $preview_image['height'] . 'px</span></div>';
|
||||
$output .= '<div class="width" style="width: ' . $preview_width . 'px"><span>' . $preview_image['width'] . 'px</span></div>';
|
||||
$output .= '</div>'; // End preview-image.
|
||||
|
|
|
@ -360,7 +360,7 @@ function image_field_widget_process($element, &$form_state, $form) {
|
|||
if ($element['#file'] && $widget_settings['preview_image_style']) {
|
||||
$variables = array(
|
||||
'style_name' => $widget_settings['preview_image_style'],
|
||||
'path' => $element['#file']->uri,
|
||||
'uri' => $element['#file']->uri,
|
||||
);
|
||||
|
||||
// Determine image dimensions.
|
||||
|
@ -569,33 +569,24 @@ function image_field_formatter_view($entity_type, $entity, $field, $instance, $l
|
|||
* An associative array containing:
|
||||
* - item: An array of image data.
|
||||
* - image_style: An optional image style.
|
||||
* - path: An array containing the link 'path' and link 'options'.
|
||||
* - path: An optional array containing the link 'path' and link 'options'.
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
function theme_image_formatter($variables) {
|
||||
$item = $variables['item'];
|
||||
$image = array(
|
||||
'path' => $item['uri'],
|
||||
'alt' => $item['alt'],
|
||||
);
|
||||
|
||||
if (isset($item['width']) && isset($item['height'])) {
|
||||
$image['width'] = $item['width'];
|
||||
$image['height'] = $item['height'];
|
||||
}
|
||||
|
||||
// Do not output an empty 'title' attribute.
|
||||
if (drupal_strlen($item['title']) > 0) {
|
||||
$image['title'] = $item['title'];
|
||||
if (drupal_strlen($item['title']) == 0) {
|
||||
unset($item['title']);
|
||||
}
|
||||
|
||||
if ($variables['image_style']) {
|
||||
$image['style_name'] = $variables['image_style'];
|
||||
$output = theme('image_style', $image);
|
||||
$item['style_name'] = $variables['image_style'];
|
||||
$output = theme('image_style', $item);
|
||||
}
|
||||
else {
|
||||
$output = theme('image', $image);
|
||||
$output = theme('image', $item);
|
||||
}
|
||||
|
||||
if (!empty($variables['path']['path'])) {
|
||||
|
|
|
@ -876,15 +876,15 @@ function image_style_flush($style) {
|
|||
*
|
||||
* @param $style_name
|
||||
* The name of the style to be used with this image.
|
||||
* @param $path
|
||||
* @param $uri
|
||||
* The path to the image.
|
||||
* @return
|
||||
* The absolute URL where a style image can be downloaded, suitable for use
|
||||
* in an <img> tag. Requesting the URL will cause the image to be created.
|
||||
* @see image_style_deliver()
|
||||
*/
|
||||
function image_style_url($style_name, $path) {
|
||||
$uri = image_style_path($style_name, $path);
|
||||
function image_style_url($style_name, $uri) {
|
||||
$uri = image_style_path($style_name, $uri);
|
||||
|
||||
// If not using clean URLs, the image derivative callback is only available
|
||||
// with the query string. If the file does not exist, use url() to ensure
|
||||
|
@ -1162,7 +1162,7 @@ function image_effect_apply($image, $effect) {
|
|||
* @param $variables
|
||||
* An associative array containing:
|
||||
* - style_name: The name of the style to be used to alter the original image.
|
||||
* - path: The path of the image file relative to the Drupal files directory.
|
||||
* - uri: The path of the image file relative to the Drupal files directory.
|
||||
* This function does not work with images outside the files directory nor
|
||||
* with remotely hosted images.
|
||||
* - width: The width of the source image (if known).
|
||||
|
@ -1187,7 +1187,7 @@ function theme_image_style($variables) {
|
|||
$variables['height'] = $dimensions['height'];
|
||||
|
||||
// Determine the url for the styled image.
|
||||
$variables['path'] = image_style_url($variables['style_name'], $variables['path']);
|
||||
$variables['uri'] = image_style_url($variables['style_name'], $variables['uri']);
|
||||
return theme('image', $variables);
|
||||
}
|
||||
|
||||
|
|
|
@ -666,7 +666,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
|||
// Test that the default formatter is being used.
|
||||
$image_uri = $node->{$field_name}[LANGUAGE_NONE][0]['uri'];
|
||||
$image_info = array(
|
||||
'path' => $image_uri,
|
||||
'uri' => $image_uri,
|
||||
'width' => 40,
|
||||
'height' => 20,
|
||||
);
|
||||
|
@ -713,7 +713,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
|||
// Ensure the derivative image is generated so we do not have to deal with
|
||||
// image style callback paths.
|
||||
$this->drupalGet(image_style_url('thumbnail', $image_uri));
|
||||
$image_info['path'] = image_style_path('thumbnail', $image_uri);
|
||||
$image_info['uri'] = image_style_path('thumbnail', $image_uri);
|
||||
$image_info['width'] = 100;
|
||||
$image_info['height'] = 50;
|
||||
$default_output = theme('image', $image_info);
|
||||
|
@ -764,7 +764,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
|||
// style.
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$image_info = array(
|
||||
'path' => image_style_url('medium', $node->{$field_name}[LANGUAGE_NONE][0]['uri']),
|
||||
'uri' => image_style_url('medium', $node->{$field_name}[LANGUAGE_NONE][0]['uri']),
|
||||
'width' => 220,
|
||||
'height' => 110,
|
||||
);
|
||||
|
@ -773,7 +773,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
|||
|
||||
// Add alt/title fields to the image and verify that they are displayed.
|
||||
$image_info = array(
|
||||
'path' => $node->{$field_name}[LANGUAGE_NONE][0]['uri'],
|
||||
'uri' => $node->{$field_name}[LANGUAGE_NONE][0]['uri'],
|
||||
'alt' => $this->randomName(),
|
||||
'title' => $this->randomName(),
|
||||
'width' => 40,
|
||||
|
@ -815,7 +815,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
|||
$field = field_info_field($field_name);
|
||||
$image = file_load($field['settings']['default_image']);
|
||||
$this->assertTrue($image->status == FILE_STATUS_PERMANENT, t('The default image status is permanent.'));
|
||||
$default_output = theme('image', array('path' => $image->uri));
|
||||
$default_output = theme('image', array('uri' => $image->uri));
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$this->assertRaw($default_output, t('Default image displayed when no user supplied image is present.'));
|
||||
|
||||
|
@ -824,7 +824,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
|||
$nid = $this->uploadNodeImage($images[1], $field_name, 'article');
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$image_info = array(
|
||||
'path' => $node->{$field_name}[LANGUAGE_NONE][0]['uri'],
|
||||
'uri' => $node->{$field_name}[LANGUAGE_NONE][0]['uri'],
|
||||
'width' => 40,
|
||||
'height' => 20,
|
||||
);
|
||||
|
@ -858,7 +858,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
|||
// Create a new node with no image attached and ensure that default private
|
||||
// image is displayed.
|
||||
$node = $this->drupalCreateNode(array('type' => 'article'));
|
||||
$default_output = theme('image', array('path' => $image->uri));
|
||||
$default_output = theme('image', array('uri' => $image->uri));
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$this->assertRaw($default_output, t('Default private image displayed when no user supplied image is present.'));
|
||||
}
|
||||
|
@ -945,7 +945,7 @@ class ImageDimensionsUnitTest extends DrupalWebTestCase {
|
|||
|
||||
$variables = array(
|
||||
'style_name' => 'test',
|
||||
'path' => $original_uri,
|
||||
'uri' => $original_uri,
|
||||
'width' => 40,
|
||||
'height' => 20,
|
||||
);
|
||||
|
|
|
@ -82,8 +82,8 @@ function theme_simpletest_test_table($variables) {
|
|||
// Define the images used to expand/collapse the test groups.
|
||||
$js = array(
|
||||
'images' => array(
|
||||
theme('image', array('path' => 'core/misc/menu-collapsed.png', 'width' => 7, 'height' => 7, 'alt' => t('Expand'), 'title' => t('Expand'))) . ' <a href="#" class="simpletest-collapse">(' . t('Expand') . ')</a>',
|
||||
theme('image', array('path' => 'core/misc/menu-expanded.png', 'width' => 7, 'height' => 7, 'alt' => t('Collapse'), 'title' => t('Collapse'))) . ' <a href="#" class="simpletest-collapse">(' . t('Collapse') . ')</a>',
|
||||
theme('image', array('uri' => 'core/misc/menu-collapsed.png', 'width' => 7, 'height' => 7, 'alt' => t('Expand'), 'title' => t('Expand'))) . ' <a href="#" class="simpletest-collapse">(' . t('Expand') . ')</a>',
|
||||
theme('image', array('uri' => 'core/misc/menu-expanded.png', 'width' => 7, 'height' => 7, 'alt' => t('Collapse'), 'title' => t('Collapse'))) . ' <a href="#" class="simpletest-collapse">(' . t('Collapse') . ')</a>',
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -414,10 +414,10 @@ function simpletest_result_status_image($status) {
|
|||
|
||||
if (!isset($map)) {
|
||||
$map = array(
|
||||
'pass' => theme('image', array('path' => 'core/misc/watchdog-ok.png', 'width' => 18, 'height' => 18, 'alt' => t('Pass'))),
|
||||
'fail' => theme('image', array('path' => 'core/misc/watchdog-error.png', 'width' => 18, 'height' => 18, 'alt' => t('Fail'))),
|
||||
'exception' => theme('image', array('path' => 'core/misc/watchdog-warning.png', 'width' => 18, 'height' => 18, 'alt' => t('Exception'))),
|
||||
'debug' => theme('image', array('path' => 'core/misc/watchdog-warning.png', 'width' => 18, 'height' => 18, 'alt' => t('Debug'))),
|
||||
'pass' => theme('image', array('uri' => 'core/misc/watchdog-ok.png', 'width' => 18, 'height' => 18, 'alt' => t('Pass'))),
|
||||
'fail' => theme('image', array('uri' => 'core/misc/watchdog-error.png', 'width' => 18, 'height' => 18, 'alt' => t('Fail'))),
|
||||
'exception' => theme('image', array('uri' => 'core/misc/watchdog-warning.png', 'width' => 18, 'height' => 18, 'alt' => t('Exception'))),
|
||||
'debug' => theme('image', array('uri' => 'core/misc/watchdog-warning.png', 'width' => 18, 'height' => 18, 'alt' => t('Debug'))),
|
||||
);
|
||||
}
|
||||
if (isset($map[$status])) {
|
||||
|
|
|
@ -154,7 +154,7 @@ function system_themes_page() {
|
|||
foreach (array_reverse($theme_keys) as $theme_key) {
|
||||
if (isset($themes[$theme_key]) && file_exists($themes[$theme_key]->info['screenshot'])) {
|
||||
$theme->screenshot = array(
|
||||
'path' => $themes[$theme_key]->info['screenshot'],
|
||||
'uri' => $themes[$theme_key]->info['screenshot'],
|
||||
'alt' => t('Screenshot for !theme theme', array('!theme' => $theme->info['name'])),
|
||||
'title' => t('Screenshot for !theme theme', array('!theme' => $theme->info['name'])),
|
||||
'attributes' => array('class' => array('screenshot')),
|
||||
|
@ -1003,7 +1003,7 @@ function _system_modules_build_row($info, $extra) {
|
|||
}
|
||||
else {
|
||||
$form['enable'] = array(
|
||||
'#markup' => theme('image', array('path' => 'core/misc/watchdog-error.png', 'alt' => $status_short, 'title' => $status_short)),
|
||||
'#markup' => theme('image', array('uri' => 'core/misc/watchdog-error.png', 'alt' => $status_short, 'title' => $status_short)),
|
||||
);
|
||||
$form['description']['#markup'] .= theme('system_modules_incompatible', array('message' => $status_long));
|
||||
}
|
||||
|
|
|
@ -57,25 +57,25 @@ function theme_update_report($variables) {
|
|||
switch ($project['status']) {
|
||||
case UPDATE_CURRENT:
|
||||
$class = 'ok';
|
||||
$icon = theme('image', array('path' => 'core/misc/watchdog-ok.png', 'width' => 18, 'height' => 18, 'alt' => t('ok'), 'title' => t('ok')));
|
||||
$icon = theme('image', array('uri' => 'core/misc/watchdog-ok.png', 'width' => 18, 'height' => 18, 'alt' => t('ok'), 'title' => t('ok')));
|
||||
break;
|
||||
case UPDATE_UNKNOWN:
|
||||
case UPDATE_FETCH_PENDING:
|
||||
case UPDATE_NOT_FETCHED:
|
||||
$class = 'unknown';
|
||||
$icon = theme('image', array('path' => 'core/misc/watchdog-warning.png', 'width' => 18, 'height' => 18, 'alt' => t('warning'), 'title' => t('warning')));
|
||||
$icon = theme('image', array('uri' => 'core/misc/watchdog-warning.png', 'width' => 18, 'height' => 18, 'alt' => t('warning'), 'title' => t('warning')));
|
||||
break;
|
||||
case UPDATE_NOT_SECURE:
|
||||
case UPDATE_REVOKED:
|
||||
case UPDATE_NOT_SUPPORTED:
|
||||
$class = 'error';
|
||||
$icon = theme('image', array('path' => 'core/misc/watchdog-error.png', 'width' => 18, 'height' => 18, 'alt' => t('error'), 'title' => t('error')));
|
||||
$icon = theme('image', array('uri' => 'core/misc/watchdog-error.png', 'width' => 18, 'height' => 18, 'alt' => t('error'), 'title' => t('error')));
|
||||
break;
|
||||
case UPDATE_NOT_CHECKED:
|
||||
case UPDATE_NOT_CURRENT:
|
||||
default:
|
||||
$class = 'warning';
|
||||
$icon = theme('image', array('path' => 'core/misc/watchdog-warning.png', 'width' => 18, 'height' => 18, 'alt' => t('warning'), 'title' => t('warning')));
|
||||
$icon = theme('image', array('uri' => 'core/misc/watchdog-warning.png', 'width' => 18, 'height' => 18, 'alt' => t('warning'), 'title' => t('warning')));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1411,10 +1411,10 @@ function template_preprocess_user_picture(&$variables) {
|
|||
// If the image does not have a valid Drupal scheme (for eg. HTTP),
|
||||
// don't load image styles.
|
||||
if (module_exists('image') && file_valid_uri($filepath) && $style = variable_get('user_picture_style', '')) {
|
||||
$variables['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt));
|
||||
$variables['user_picture'] = theme('image_style', array('style_name' => $style, 'uri' => $filepath, 'alt' => $alt, 'title' => $alt));
|
||||
}
|
||||
else {
|
||||
$variables['user_picture'] = theme('image', array('path' => $filepath, 'alt' => $alt, 'title' => $alt));
|
||||
$variables['user_picture'] = theme('image', array('uri' => $filepath, 'alt' => $alt, 'title' => $alt));
|
||||
}
|
||||
if (!empty($account->uid) && user_access('access user profiles')) {
|
||||
$attributes = array('attributes' => array('title' => t('View user profile.')), 'html' => TRUE);
|
||||
|
|
|
@ -1077,7 +1077,7 @@ class UserPictureTestCase extends DrupalWebTestCase {
|
|||
// Get the user picture image via xpath.
|
||||
$elements = $this->xpath('//div[@class="user-picture"]/img');
|
||||
$this->assertEqual(count($elements), 1, t("There is exactly one user picture on the user's profile page"));
|
||||
$this->assertEqual($pic_path, (string) $elements[0]['src'], t("User picture source is correct."));
|
||||
$this->assertEqual($pic_path, (string) $elements[0]['src'], t("User picture source is correct: " . $pic_path . " " . print_r($elements, TRUE)));
|
||||
}
|
||||
|
||||
function saveUserPicture($image) {
|
||||
|
|
|
@ -88,10 +88,10 @@ function seven_tablesort_indicator($variables) {
|
|||
$style = $variables['style'];
|
||||
$theme_path = drupal_get_path('theme', 'seven');
|
||||
if ($style == 'asc') {
|
||||
return theme('image', array('path' => $theme_path . '/images/arrow-asc.png', 'alt' => t('sort ascending'), 'width' => 13, 'height' => 13, 'title' => t('sort ascending')));
|
||||
return theme('image', array('uri' => $theme_path . '/images/arrow-asc.png', 'alt' => t('sort ascending'), 'width' => 13, 'height' => 13, 'title' => t('sort ascending')));
|
||||
}
|
||||
else {
|
||||
return theme('image', array('path' => $theme_path . '/images/arrow-desc.png', 'alt' => t('sort descending'), 'width' => 13, 'height' => 13, 'title' => t('sort descending')));
|
||||
return theme('image', array('uri' => $theme_path . '/images/arrow-desc.png', 'alt' => t('sort descending'), 'width' => 13, 'height' => 13, 'title' => t('sort descending')));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue