summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/image/src/ImageStyleStorage.php
blob: 1a629dd0a488a1b087f3b426f2fc53926fcaebdd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php

namespace Drupal\image;

use Drupal\Core\Config\Entity\ConfigEntityStorage;

/**
 * Storage controller class for "image style" configuration entities.
 */
class ImageStyleStorage extends ConfigEntityStorage implements ImageStyleStorageInterface {

  /**
   * Image style replacement memory storage.
   *
   * This value is not stored in the backend. It's used during the deletion of
   * an image style to save the replacement image style in the same request. The
   * value is used later, when resolving dependencies.
   *
   * @var string[]
   *
   * @see \Drupal\image\Form\ImageStyleDeleteForm::submitForm()
   */
  protected $replacement = [];

  /**
   * {@inheritdoc}
   */
  public function setReplacementId($name, $replacement) {
    $this->replacement[$name] = $replacement;
  }

  /**
   * {@inheritdoc}
   */
  public function getReplacementId($name) {
    return $this->replacement[$name] ?? NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function clearReplacementId($name) {
    unset($this->replacement[$name]);
  }

}