Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -1,6 +1,7 @@
|
|||
services:
|
||||
path_processor.image_styles:
|
||||
class: Drupal\image\PathProcessor\PathProcessorImageStyles
|
||||
arguments: ['@stream_wrapper_manager']
|
||||
tags:
|
||||
- { name: path_processor_inbound, priority: 300 }
|
||||
plugin.manager.image.effect:
|
||||
|
|
|
@ -226,7 +226,7 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface, Entity
|
|||
// to the actual file path, this avoids bootstrapping PHP once the files are
|
||||
// built.
|
||||
if ($clean_urls === FALSE && file_uri_scheme($uri) == 'public' && !file_exists($uri)) {
|
||||
$directory_path = file_stream_wrapper_get_instance_by_uri($uri)->getDirectoryPath();
|
||||
$directory_path = \Drupal::service('stream_wrapper_manager')->getViaUri($uri)->getDirectoryPath();
|
||||
return Url::fromUri('base:' . $directory_path . '/' . file_uri_target($uri), array('absolute' => TRUE, 'query' => $token_query))->toString();
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface, Entity
|
|||
// Clear caches so that formatters may be added for this style.
|
||||
drupal_theme_rebuild();
|
||||
|
||||
Cache::invalidateTags($this->getCacheTags());
|
||||
Cache::invalidateTags($this->getCacheTagsToInvalidate());
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ use Drupal\Core\Form\FormStateInterface;
|
|||
use Drupal\image\ConfigurableImageEffectInterface;
|
||||
use Drupal\image\ImageStyleInterface;
|
||||
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
|
@ -61,7 +60,7 @@ abstract class ImageEffectFormBase extends FormBase {
|
|||
$this->imageEffect = $this->prepareImageEffect($image_effect);
|
||||
}
|
||||
catch (PluginNotFoundException $e) {
|
||||
throw new NotFoundHttpException(SafeMarkup::format("Invalid effect id: '@id'.", array('@id' => $image_effect)));
|
||||
throw new NotFoundHttpException("Invalid effect id: '$image_effect'.");
|
||||
}
|
||||
$request = $this->getRequest();
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
namespace Drupal\image\PathProcessor;
|
||||
|
||||
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
|
||||
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
|
@ -27,11 +28,28 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
*/
|
||||
class PathProcessorImageStyles implements InboundPathProcessorInterface {
|
||||
|
||||
/**
|
||||
* The stream wrapper manager service.
|
||||
*
|
||||
* @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
|
||||
*/
|
||||
protected $streamWrapperManager;
|
||||
|
||||
/**
|
||||
* Constructs a new PathProcessorImageStyles object.
|
||||
*
|
||||
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager
|
||||
* The stream wrapper manager service.
|
||||
*/
|
||||
public function __construct(StreamWrapperManagerInterface $stream_wrapper_manager) {
|
||||
$this->streamWrapperManager = $stream_wrapper_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processInbound($path, Request $request) {
|
||||
$directory_path = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath();
|
||||
$directory_path = $this->streamWrapperManager->getViaScheme('public')->getDirectoryPath();
|
||||
if (strpos($path, '/' . $directory_path . '/styles/') === 0) {
|
||||
$path_prefix = '/' . $directory_path . '/styles/';
|
||||
}
|
||||
|
@ -43,7 +61,7 @@ class PathProcessorImageStyles implements InboundPathProcessorInterface {
|
|||
}
|
||||
|
||||
// Strip out path prefix.
|
||||
$rest = preg_replace('|^' . $path_prefix . '|', '', $path);
|
||||
$rest = preg_replace('|^' . preg_quote($path_prefix, '|') . '|', '', $path);
|
||||
|
||||
// Get the image style, scheme and path.
|
||||
if (substr_count($rest, '/') >= 2) {
|
||||
|
|
|
@ -7,12 +7,41 @@
|
|||
|
||||
namespace Drupal\image\Routing;
|
||||
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
/**
|
||||
* Defines a route subscriber to register a url for serving image styles.
|
||||
*/
|
||||
class ImageStyleRoutes {
|
||||
class ImageStyleRoutes implements ContainerInjectionInterface {
|
||||
|
||||
/**
|
||||
* The stream wrapper manager service.
|
||||
*
|
||||
* @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
|
||||
*/
|
||||
protected $streamWrapperManager;
|
||||
|
||||
/**
|
||||
* Constructs a new PathProcessorImageStyles object.
|
||||
*
|
||||
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager
|
||||
* The stream wrapper manager service.
|
||||
*/
|
||||
public function __construct(StreamWrapperManagerInterface $stream_wrapper_manager) {
|
||||
$this->streamWrapperManager = $stream_wrapper_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('stream_wrapper_manager')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of route objects.
|
||||
|
@ -26,7 +55,7 @@ class ImageStyleRoutes {
|
|||
// disabled image derivatives will always be served through the menu system.
|
||||
// If clean URLs are enabled and the image derivative already exists, PHP
|
||||
// will be bypassed.
|
||||
$directory_path = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath();
|
||||
$directory_path = $this->streamWrapperManager->getViaScheme('public')->getDirectoryPath();
|
||||
|
||||
$routes['image.style_public'] = new Route(
|
||||
'/' . $directory_path . '/styles/{image_style}/{scheme}',
|
||||
|
|
|
@ -11,6 +11,7 @@ use Drupal\Component\Utility\SafeMarkup;
|
|||
use Drupal\image\Entity\ImageStyle;
|
||||
use Drupal\image\ImageStyleInterface;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\file\Entity\File;
|
||||
|
||||
/**
|
||||
* Tests creation, deletion, and editing of image styles and effects.
|
||||
|
@ -302,7 +303,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
|
||||
// Get node field original image URI.
|
||||
$fid = $node->get($field_name)->target_id;
|
||||
$original_uri = file_load($fid)->getFileUri();
|
||||
$original_uri = File::load($fid)->getFileUri();
|
||||
|
||||
// Test that image is displayed using newly created style.
|
||||
$this->drupalGet('node/' . $nid);
|
||||
|
@ -436,7 +437,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
|
||||
// Get node field original image URI.
|
||||
$fid = $node->get($field_name)->target_id;
|
||||
$original_uri = file_load($fid)->getFileUri();
|
||||
$original_uri = File::load($fid)->getFileUri();
|
||||
|
||||
// Test that image is displayed using newly created style.
|
||||
$this->drupalGet('node/' . $nid);
|
||||
|
|
Reference in a new issue