Issue #2048827 by claudiu.cristea, tim.plunkett: Move Image toolkit API from system.module to Drupal\Core.

8.0.x
webchick 2013-10-08 16:26:42 -07:00
parent 652c334234
commit 9a09f69b7d
13 changed files with 34 additions and 37 deletions

View File

@ -509,10 +509,10 @@ services:
tags:
- { name: event_subscriber }
image.toolkit.manager:
class: Drupal\system\Plugin\ImageToolkitManager
class: Drupal\Core\ImageToolkit\ImageToolkitManager
arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@config.factory']
image.toolkit:
class: Drupal\system\Plugin\ImageToolkitInterface
class: Drupal\Core\ImageToolkit\ImageToolkitInterface
factory_method: getDefaultToolkit
factory_service: image.toolkit.manager
image.factory:

View File

@ -7,13 +7,13 @@
namespace Drupal\Core\Image;
use Drupal\system\Plugin\ImageToolkitInterface;
use Drupal\Core\ImageToolkit\ImageToolkitInterface;
use Drupal\Component\Utility\Image as ImageUtility;
/**
* Defines an image object to represent an image file.
*
* @see \Drupal\system\Plugin\ImageToolkitInterface
* @see \Drupal\Core\ImageToolkit\ImageToolkitInterface
* @see \Drupal\image\ImageEffectInterface
*
* @ingroup image
@ -30,7 +30,7 @@ class Image implements ImageInterface {
/**
* An image toolkit object.
*
* @var \Drupal\system\Plugin\ImageToolkitInterface
* @var \Drupal\Core\ImageToolkit\ImageToolkitInterface
*/
protected $toolkit;
@ -95,7 +95,7 @@ class Image implements ImageInterface {
*
* @param string $source
* The path to an image file.
* @param \Drupal\system\Plugin\ImageToolkitInterface $toolkit
* @param \Drupal\Core\ImageToolkit\ImageToolkitInterface $toolkit
* The image toolkit.
*/
public function __construct($source, ImageToolkitInterface $toolkit) {

View File

@ -7,7 +7,7 @@
namespace Drupal\Core\Image;
use Drupal\system\Plugin\ImageToolkitInterface;
use Drupal\Core\ImageToolkit\ImageToolkitInterface;
/**
* Provides a factory for image objects.
@ -17,14 +17,14 @@ class ImageFactory {
/**
* The image toolkit to use for this factory.
*
* @var \Drupal\system\Plugin\ImageToolkitInterface
* @var \Drupal\Core\ImageToolkit\ImageToolkitInterface
*/
protected $toolkit;
/**
* Constructs a new ImageFactory object.
*
* @param \Drupal\system\Plugin\ImageToolkitInterface $toolkit
* @param \Drupal\Core\ImageToolkit\ImageToolkitInterface $toolkit
* The image toolkit to use for this image factory.
*/
public function __construct(ImageToolkitInterface $toolkit) {
@ -34,7 +34,7 @@ class ImageFactory {
/**
* Sets a custom image toolkit.
*
* @param \Drupal\system\Plugin\ImageToolkitInterface $toolkit
* @param \Drupal\Core\ImageToolkit\ImageToolkitInterface $toolkit
* The image toolkit to use for this image factory.
*
* @return self

View File

@ -153,7 +153,7 @@ interface ImageInterface {
* @return bool
* TRUE on success, FALSE on failure.
*
* @see \Drupal\system\Plugin\ImageToolkitInterface::save()
* @see \Drupal\Core\ImageToolkit\ImageToolkitInterface::save()
*/
public function save($destination = NULL);
@ -211,7 +211,7 @@ interface ImageInterface {
* @return bool
* TRUE on success, FALSE on failure.
*
* @see \Drupal\system\Plugin\ImageToolkitInterface::crop()
* @see \Drupal\Core\ImageToolkit\ImageToolkitInterface::crop()
*/
public function crop($x, $y, $width, $height);
@ -226,7 +226,7 @@ interface ImageInterface {
* @return bool
* TRUE on success, FALSE on failure.
*
* @see \Drupal\system\Plugin\ImageToolkitInterface::resize()
* @see \Drupal\Core\ImageToolkit\ImageToolkitInterface::resize()
*/
public function resize($width, $height);
@ -236,7 +236,7 @@ interface ImageInterface {
* @return bool
* TRUE on success, FALSE on failure.
*
* @see \Drupal\system\Plugin\ImageToolkitInterface::desaturate()
* @see \Drupal\Core\ImageToolkit\ImageToolkitInterface::desaturate()
*/
public function desaturate();
@ -255,7 +255,7 @@ interface ImageInterface {
* @return bool
* TRUE on success, FALSE on failure.
*
* @see \Drupal\system\Plugin\ImageToolkitInterface::rotate()
* @see \Drupal\Core\ImageToolkit\ImageToolkitInterface::rotate()
*/
public function rotate($degrees, $background = NULL);

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\system\Plugin\ImageToolkitInterface.
* Contains \Drupal\Core\ImageToolkit\ImageToolkitInterface.
*/
namespace Drupal\system\Plugin;
namespace Drupal\Core\ImageToolkit;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Core\Image\ImageInterface;
@ -28,13 +28,13 @@ use Drupal\Core\Image\ImageInterface;
* software.
*
* Image toolkits are discovered using the Plugin system using
* \Drupal\system\Plugin\ImageToolkitManager. The toolkit must then be enabled
* using the admin/config/media/image-toolkit form.
* \Drupal\Core\ImageToolkit\ImageToolkitManager. The toolkit must then be
* enabled using the admin/config/media/image-toolkit form.
*
* Only one toolkit may be selected at a time. If a module author wishes to call
* a specific toolkit they can check that it is installed by calling
* \Drupal\system\Plugin\ImageToolkitManager::getAvailableToolkits(), and then
* calling its functions directly.
* \Drupal\Core\ImageToolkit\ImageToolkitManager::getAvailableToolkits(), and
* then calling its functions directly.
*/
/**
@ -189,4 +189,5 @@ interface ImageToolkitInterface extends PluginInspectionInterface {
* IMAGETYPE_* constant (e.g. IMAGETYPE_JPEG, IMAGETYPE_PNG, etc.).
*/
public static function supportedTypes();
}

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\system\Plugin\ImageToolkitManager.
* Contains \Drupal\Core\ImageToolkit\ImageToolkitManager.
*/
namespace Drupal\system\Plugin;
namespace Drupal\Core\ImageToolkit;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Config\ConfigFactory;
@ -47,11 +47,7 @@ class ImageToolkitManager extends DefaultPluginManager {
/**
* Gets the default image toolkit.
*
* @param string $toolkit_id
* (optional) String specifying toolkit to load. NULL will load the default
* toolkit.
*
* @return \Drupal\system\Plugin\ImageToolkitInterface
* @return \Drupal\Core\ImageToolkit\ImageToolkitInterface
* Object of the default toolkit, or FALSE on error.
*/
public function getDefaultToolkit() {

View File

@ -14,8 +14,8 @@ use Drupal\Component\Annotation\Plugin;
*
* @Annotation
*
* @see \Drupal\system\Plugin\ImageToolkitInterface
* @see \Drupal\system\Plugin\ImageToolkitManager
* @see \Drupal\Core\ImageToolkit\ImageToolkitInterface
* @see \Drupal\Core\ImageToolkit\ImageToolkitManager
*/
class ImageToolkit extends Plugin {

View File

@ -10,7 +10,7 @@ namespace Drupal\system\Form;
use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Config\Context\ContextInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\system\Plugin\ImageToolkitManager;
use Drupal\Core\ImageToolkit\ImageToolkitManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@ -32,7 +32,7 @@ class ImageToolkitForm extends ConfigFormBase {
* The factory for configuration objects.
* @param \Drupal\Core\Config\Context\ContextInterface $context
* The configuration context used for this configuration object.
* @param \Drupal\system\Plugin\ImageToolkitManager $manager
* @param \Drupal\Core\ImageToolkit\ImageToolkitManager $manager
* The image toolkit plugin manager.
*/
public function __construct(ConfigFactory $config_factory, ContextInterface $context, ImageToolkitManager $manager) {

View File

@ -11,7 +11,7 @@ use Drupal\Core\Plugin\PluginBase;
use Drupal\system\Annotation\ImageToolkit;
use Drupal\Core\Annotation\Translation;
use Drupal\Core\Image\ImageInterface;
use Drupal\system\Plugin\ImageToolkitInterface;
use Drupal\Core\ImageToolkit\ImageToolkitInterface;
/**
* Defines the GD2 toolkit for image manipulation within Drupal.

View File

@ -24,7 +24,7 @@ abstract class ToolkitTestBase extends WebTestBase {
/**
* The image toolkit.
*
* @var \Drupal\system\Plugin\ImageToolkitInterface
* @var \Drupal\Core\ImageToolkit\ImageToolkitInterface
*/
protected $toolkit;

View File

@ -21,7 +21,7 @@ use Drupal\Core\Annotation\Translation;
class BrokenToolkit extends TestToolkit {
/**
* Implements \Drupal\system\Plugin\ImageToolkitInterface::isAvailable().
* {@inheritdoc}
*/
public static function isAvailable() {
return FALSE;

View File

@ -11,7 +11,7 @@ use Drupal\Core\Plugin\PluginBase;
use Drupal\system\Annotation\ImageToolkit;
use Drupal\Core\Annotation\Translation;
use Drupal\Core\Image\ImageInterface;
use Drupal\system\Plugin\ImageToolkitInterface;
use Drupal\Core\ImageToolkit\ImageToolkitInterface;
/**
* Defines a Test toolkit for image manipulation within Drupal.

View File

@ -25,7 +25,7 @@ class ImageTest extends UnitTestCase {
/**
* Image toolkit.
*
* @var \Drupal\system\Plugin\ImageToolkitInterface
* @var \Drupal\Core\ImageToolkit\ImageToolkitInterface
*/
protected $toolkit;