commit 1ff717892d568976fcdf73004e00bd407ff2e07e Author: kgoel Date: Wed May 1 21:06:10 2013 -0400 Issue# 1898442 replaced uri with path diff --git a/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php b/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php index f100d3a..a9625e9 100644 --- a/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php +++ b/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php @@ -135,8 +135,8 @@ public function save(array $form, array &$form_state) { // Redirect to edit form after creating a new mapping or after selecting // another breakpoint group. if (!$picture_mapping->hasMappings()) { - $uri = $picture_mapping->uri(); - $form_state['redirect'] = $uri['path'] . '/edit'; + $path = $picture_mapping->path(); + $form_state['redirect'] = $path['path'] . '/edit'; } else { $form_state['redirect'] = 'admin/config/media/picturemapping'; diff --git a/core/modules/picture/lib/Drupal/picture/PictureMappingListController.php b/core/modules/picture/lib/Drupal/picture/PictureMappingListController.php index 343dbd3..707a417 100644 --- a/core/modules/picture/lib/Drupal/picture/PictureMappingListController.php +++ b/core/modules/picture/lib/Drupal/picture/PictureMappingListController.php @@ -36,11 +36,11 @@ public function hookMenu() { */ public function getOperations(EntityInterface $entity) { $operations = parent::getOperations($entity); - $uri = $entity->uri(); + $path = $entity->path(); $operations['duplicate'] = array( 'title' => t('Duplicate'), - 'href' => $uri['path'] . '/duplicate', - 'options' => $uri['options'], + 'href' => $path['path'] . '/duplicate', + 'options' => $path['options'], 'weight' => 15, ); return $operations; diff --git a/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php b/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php index 927b170..82146d7 100644 --- a/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php +++ b/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php @@ -29,7 +29,7 @@ * } * }, * list_path = "admin/config/media/picturemapping", - * uri_callback = "picture_mapping_uri", + * path_callback = "picture_mapping_path", * config_prefix = "picture.mappings", * entity_keys = { * "id" = "id", diff --git a/core/modules/picture/lib/Drupal/picture/Plugin/field/formatter/PictureFormatter.php b/core/modules/picture/lib/Drupal/picture/Plugin/field/formatter/PictureFormatter.php index 37e0347..9342023 100644 --- a/core/modules/picture/lib/Drupal/picture/Plugin/field/formatter/PictureFormatter.php +++ b/core/modules/picture/lib/Drupal/picture/Plugin/field/formatter/PictureFormatter.php @@ -119,7 +119,7 @@ public function viewElements(EntityInterface $entity, $langcode, array $items) { $elements = array(); // Check if the formatter involves a link. if ($this->getSetting('image_link') == 'content') { - $uri = $entity->uri(); + $path = $entity->path(); } elseif ($this->getSetting('image_link') == 'file') { $link_file = TRUE; @@ -166,8 +166,8 @@ public function viewElements(EntityInterface $entity, $langcode, array $items) { foreach ($items as $delta => $item) { if (isset($link_file)) { - $uri = array( - 'path' => file_create_url($item['uri']), + $path = array( + 'path' => file_create_url($item['path']), 'options' => array(), ); } @@ -179,7 +179,7 @@ public function viewElements(EntityInterface $entity, $langcode, array $items) { '#item' => $item, '#image_style' => $fallback_image_style, '#breakpoints' => $breakpoint_styles, - '#path' => isset($uri) ? $uri : '', + '#path' => isset($path) ? $path : '', ); } diff --git a/core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php b/core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php index c8cd4cb..fee1fbc 100644 --- a/core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php +++ b/core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php @@ -115,16 +115,16 @@ public function testPictureFieldFormattersPrivate() { */ public function _testPictureFieldFormatters($scheme) { $field_name = drupal_strtolower($this->randomName()); - $this->createImageField($field_name, 'article', array('uri_scheme' => $scheme)); + $this->createImageField($field_name, 'article', array('path_scheme' => $scheme)); // Create a new node with an image attached. $test_image = current($this->drupalGetTestFiles('image')); $nid = $this->uploadNodeImage($test_image, $field_name, 'article'); $node = node_load($nid, TRUE); // Test that the default formatter is being used. - $image_uri = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri; + $image_path = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->path; $image_info = array( - 'uri' => $image_uri, + 'path' => $image_path, 'width' => 40, 'height' => 20, ); @@ -141,11 +141,11 @@ public function _testPictureFieldFormatters($scheme) { $display->setComponent($field_name, $display_options) ->save(); - $default_output = l(theme('image', $image_info), file_create_url($image_uri), array('html' => TRUE)); + $default_output = l(theme('image', $image_info), file_create_url($image_path), array('html' => TRUE)); $this->drupalGet('node/' . $nid); $this->assertRaw($default_output, 'Image linked to file formatter displaying correctly on full node view.'); // Verify that the image can be downloaded. - $this->assertEqual(file_get_contents($test_image->uri), $this->drupalGet(file_create_url($image_uri)), 'File was downloaded successfully.'); + $this->assertEqual(file_get_contents($test_image->path), $this->drupalGet(file_create_url($image_path)), 'File was downloaded successfully.'); if ($scheme == 'private') { // Only verify HTTP headers when using private scheme and the headers are // sent by Drupal. @@ -154,7 +154,7 @@ public function _testPictureFieldFormatters($scheme) { // Log out and try to access the file. $this->drupalLogout(); - $this->drupalGet(file_create_url($image_uri)); + $this->drupalGet(file_create_url($image_path)); $this->assertResponse('403', 'Access denied to original image as anonymous user.'); // Log in again. @@ -181,8 +181,8 @@ public function _testPictureFieldFormatters($scheme) { $display->setComponent($field_name, $display_options) ->save(); - $this->drupalGet(image_style_url('large', $image_uri)); - $image_info['uri'] = $image_uri; + $this->drupalGet(image_style_url('large', $image_path)); + $image_info['path'] = $image_path; $image_info['width'] = 480; $image_info['height'] = 240; $image_info['style_name'] = 'large'; @@ -193,7 +193,7 @@ public function _testPictureFieldFormatters($scheme) { if ($scheme == 'private') { // Log out and try to access the file. $this->drupalLogout(); - $this->drupalGet(image_style_url('large', $image_uri)); + $this->drupalGet(image_style_url('large', $image_path)); $this->assertResponse('403', 'Access denied to image style thumbnail as anonymous user.'); } } diff --git a/core/modules/picture/picture.module b/core/modules/picture/picture.module index 9dc9a6f..6a809a8 100644 --- a/core/modules/picture/picture.module +++ b/core/modules/picture/picture.module @@ -130,18 +130,18 @@ function picture_mapping_load($id) { } /** - * Gets Picture uri callback. + * Gets Picture path callback. */ -function picture_mapping_uri(PictureMapping $picture_mapping) { +function picture_mapping_path(PictureMapping $picture_mapping) { return array( 'path' => 'admin/config/media/picturemapping/' . $picture_mapping->id(), ); } /** - * Sets Picture uri callback. + * Sets Picture path callback. */ -function picture_mapping_set_uri(PictureMapping $picture_mapping) { +function picture_mapping_set_path(PictureMapping $picture_mapping) { return array( 'path' => 'admin/config/media/picturemapping/' . $picture_mapping->id(), ); @@ -210,8 +210,8 @@ function theme_picture_formatter($variables) { $item['style_name'] = $variables['image_style']; $item['breakpoints'] = $variables['breakpoints']; - if (!isset($item['path']) && isset($variables['uri'])) { - $item['path'] = $variables['uri']; + if (!isset($item['path']) && isset($variables['path'])) { + $item['path'] = $variables['path']; } $output = theme('picture', $item); @@ -229,7 +229,7 @@ function theme_picture_formatter($variables) { * * @param $variables * An associative array containing: - * - uri: Either the path of the image file (relative to base_path()) or a + * - path: 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). @@ -256,7 +256,7 @@ function theme_picture($variables) { // Fallback image, output as source with media query. $sources[] = array( - 'src' => image_style_url($variables['style_name'], $variables['uri']), + 'src' => image_style_url($variables['style_name'], $variables['path']), 'dimensions' => picture_get_image_dimensions($variables), ); @@ -275,7 +275,7 @@ function theme_picture($variables) { // Only one image, use src. if (count($new_sources) == 1) { $sources[] = array( - 'src' => image_style_url($new_sources[0]['style_name'], $new_sources[0]['uri']), + 'src' => image_style_url($new_sources[0]['style_name'], $new_sources[0]['path']), 'dimensions' => picture_get_image_dimensions($new_sources[0]), 'media' => $breakpoint->mediaQuery, ); @@ -284,7 +284,7 @@ function theme_picture($variables) { // Mutliple images, use srcset. $srcset = array(); foreach ($new_sources as $new_source) { - $srcset[] = image_style_url($new_source['style_name'], $new_source['uri']) . ' ' . $new_source['#multiplier']; + $srcset[] = image_style_url($new_source['style_name'], $new_source['path']) . ' ' . $new_source['#multiplier']; } $sources[] = array( 'srcset' => implode(', ', $srcset),