Drupal 8  8.0.2
ImageEffectBase Class Reference
Inheritance diagram for ImageEffectBase:

Public Member Functions

 __construct (array $configuration, $plugin_id, $plugin_definition, LoggerInterface $logger)
 
 transformDimensions (array &$dimensions, $uri)
 
 getDerivativeExtension ($extension)
 
 getSummary ()
 
 label ()
 
 getUuid ()
 
 setWeight ($weight)
 
 getWeight ()
 
 getConfiguration ()
 
 setConfiguration (array $configuration)
 
 defaultConfiguration ()
 
 calculateDependencies ()
 
- Public Member Functions inherited from ImageEffectInterface
 applyEffect (ImageInterface $image)
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 

Static Public Member Functions

static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 

Protected Attributes

 $uuid
 
 $weight = ''
 
 $logger
 

Detailed Description

Provides a base class for image effects.

See Also
Plugin API

Constructor & Destructor Documentation

__construct ( array  $configuration,
  $plugin_id,
  $plugin_definition,
LoggerInterface  $logger 
)

{}

References Drupal\logger(), and ImageEffectBase\setConfiguration().

Here is the call graph for this function:

Member Function Documentation

calculateDependencies ( )

{Calculates dependencies for the configured plugin.Dependencies are saved in the plugin's configuration entity and are used to determine configuration synchronization order. For example, if the plugin integrates with specific user roles, this method should return an array of dependencies listing the specified roles.

Returns
array An array of dependencies grouped by type (config, content, module, theme). For example:
array(
'config' => array('user.role.anonymous', 'user.role.authenticated'),
'content' => array('node:article:f0a189e6-55fb-47fb-8005-5bef81c44d6d'),
'module' => array('node', 'user'),
'theme' => array('seven'),
);
See Also
::getConfigDependencyName()
}

Implements DependentPluginInterface.

static create ( ContainerInterface  $container,
array  $configuration,
  $plugin_id,
  $plugin_definition 
)
static

{Creates an instance of the plugin.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$containerThe container to pull out services used in the plugin.
array$configurationA configuration array containing information about the plugin instance.
string$plugin_idThe plugin ID for the plugin instance.
mixed$plugin_definitionThe plugin implementation definition.
Returns
static Returns an instance of this plugin.
}

Implements ContainerFactoryPluginInterface.

defaultConfiguration ( )

{Gets default configuration for this plugin.

Returns
array An associative array with the default configuration.
}

Implements ConfigurablePluginInterface.

Referenced by ImageEffectBase\setConfiguration().

Here is the caller graph for this function:

getConfiguration ( )

{Gets this plugin's configuration.

Returns
array An array of this plugin's configuration.
}

Implements ConfigurablePluginInterface.

References PluginInspectionInterface\getPluginId(), ImageEffectBase\getUuid(), and ImageEffectBase\getWeight().

Here is the call graph for this function:

getDerivativeExtension (   $extension)

{Returns the extension the derivative would have have after applying this image effect.

Parameters
string$extensionThe file extension the derivative has before applying.
Returns
string The file extension after applying.
}

Implements ImageEffectInterface.

getSummary ( )

{Returns a render array summarizing the configuration of the image effect.

Returns
array A render array.
}

Implements ImageEffectInterface.

References ImageEffectBase\label().

Here is the call graph for this function:

getUuid ( )

{Returns the unique ID representing the image effect.

Returns
string The image effect ID.
}

Implements ImageEffectInterface.

Referenced by ImageEffectBase\getConfiguration().

Here is the caller graph for this function:

getWeight ( )

{Returns the weight of the image effect.

Returns
int|string Either the integer weight of the image effect, or an empty string.
}

Implements ImageEffectInterface.

Referenced by ImageEffectBase\getConfiguration().

Here is the caller graph for this function:

label ( )

{Returns the image effect label.

Returns
string The image effect label.
}

Implements ImageEffectInterface.

Referenced by ImageEffectBase\getSummary().

Here is the caller graph for this function:

setConfiguration ( array  $configuration)

{Sets the configuration for this plugin instance.

Parameters
array$configurationAn associative array containing the plugin's configuration.
}

Implements ConfigurablePluginInterface.

References ImageEffectBase\defaultConfiguration().

Referenced by ImageEffectBase\__construct().

Here is the call graph for this function:

Here is the caller graph for this function:

setWeight (   $weight)

{Sets the weight for this image effect.

Parameters
int$weightThe weight for this image effect.
Returns
$this
}

Implements ImageEffectInterface.

transformDimensions ( array &  $dimensions,
  $uri 
)

{Determines the dimensions of the styled image.

Parameters
array&$dimensionsDimensions to be modified - an array with the following keys:
  • width: the width in pixels, or NULL if unknown
  • height: the height in pixels, or NULL if unknown When either of the dimensions are NULL, the corresponding HTML attribute will be omitted when an image style using this image effect is used.
string$uriOriginal image file URI. It is passed in to allow an effect to optionally use this information to retrieve additional image metadata to determine dimensions of the styled image. ImageEffectInterface::transformDimensions key objective is to calculate styled image dimensions without performing actual image operations, so be aware that performing IO on the URI may lead to decrease in performance.
}

Implements ImageEffectInterface.


The documentation for this class was generated from the following file: