@@ -112,6 +110,47 @@ public static function create(ContainerInterface $container, array $configuratio
);
}
/**
* {@inheritdoc}
*/
publicfunction__get(string$name){
if($name==='resource'){
@trigger_error('Accessing the \Drupal\system\Plugin\ImageToolkit\GDToolkit::resource property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::image instead.',E_USER_DEPRECATED);
@trigger_error('Setting the \Drupal\system\Plugin\ImageToolkit\GDToolkit::resource property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::image instead.',E_USER_DEPRECATED);
$this->image=$value;
}
}
/**
* {@inheritdoc}
*/
publicfunction__isset(string$name):bool{
if($name==='resource'){
@trigger_error('Checking the \Drupal\system\Plugin\ImageToolkit\GDToolkit::resource property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::image instead.',E_USER_DEPRECATED);
returnisset($this->image);
}
returnFALSE;
}
/**
* {@inheritdoc}
*/
publicfunction__unset(string$name):void{
if($name==='resource'){
@trigger_error('Unsetting the \Drupal\system\Plugin\ImageToolkit\GDToolkit::resource property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::image instead.',E_USER_DEPRECATED);
unset($this->image);
}
}
/**
* Sets the GD image resource.
*
@@ -120,14 +159,18 @@ public static function create(ContainerInterface $container, array $configuratio
*
* @return $this
* An instance of the current toolkit object.
*
* @deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use
@trigger_error(__METHOD__.'() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::setImage() instead. See https://www.drupal.org/node/3265963',E_USER_DEPRECATED);
@trigger_error(__METHOD__.'() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::getImage() instead. See https://www.drupal.org/node/3265963',E_USER_DEPRECATED);
return$this->getImage();
}
/**
* Sets an image or resets existing one.
*
* @param \GdImage|null $image
* The GD image object or NULL.
*
* @return $this
* An instance of the current toolkit object.
*/
publicfunctionsetImage(?\GdImage$image):static{
$this->preLoadInfo=NULL;
$this->image=$image;
return$this;
}
/**
* Retrieves the image.
*
* @return \GdImage|null
* The GD image object, or NULL if not available.
*/
publicfunctiongetImage():?\GdImage{
if(!$this->image){
$this->load();
}
return$this->resource;
return$this->image;
}
/**
@@ -169,7 +243,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s
}
/**
* Loads a GD resource from a file.
* Loads an image from a file.
*
* @return bool
* TRUE or FALSE, based on success.
@@ -194,7 +268,7 @@ protected function load() {
// Invalidate the image object and return if the load fails.
* description = @Translation("Creates a new transparent resource and sets it for the image.")
* description = @Translation("Creates a new transparent object and sets it for the image.")
* )
*/
classCreateNewextendsGDImageToolkitOperationBase{
@@ -39,7 +39,7 @@ protected function arguments() {
'default'=>'#ffffff',
],
'is_temp'=>[
'description'=>'If TRUE, this operation is being used to create a temporary image by another GD operation. After performing its function, the caller is responsible for destroying the original GD resource.',
'description'=>'If TRUE, this operation is being used to create a temporary image by another GD operation. After performing its function, the original GD object will be destroyed automatically.',
'required'=>FALSE,
'default'=>FALSE,
],
@@ -82,52 +82,44 @@ protected function execute(array $arguments) {