You are here

public function PagererPreset::setPaneData in Pagerer 8

Same name and namespace in other branches
  1. 8.2 src/Entity/PagererPreset.php \Drupal\pagerer\Entity\PagererPreset::setPaneData()

Sets a pane configuration element.

Parameters

string $pane: The pane (left|center|right).

string $key: The configuration element as a string where '.' identifies array nesting.

mixed $value: The value to be set.

Return value

$this

File

src/Entity/PagererPreset.php, line 141

Class

PagererPreset
Defines a Pagerer preset configuration entity.

Namespace

Drupal\pagerer\Entity

Code

public function setPaneData($pane, $key, $value) {
  $keys = explode('.', $key);
  $n =& $this->panes[$pane];
  foreach ($keys as $k) {
    if (!empty($n[$k])) {
      $n =& $n[$k];
    }
    else {
      $n[$k] = [];
      $n =& $n[$k];
    }
  }
  $n = $value;
  return $this;
}