You are here

public function PagererPreset::unsetPaneData in Pagerer 8

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

Unsets a pane configuration element.

Parameters

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

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

Return value

$this

1 call to PagererPreset::unsetPaneData()
PagererPreset::preSave in src/Entity/PagererPreset.php
Acts on an entity before the presave hook is invoked.

File

src/Entity/PagererPreset.php, line 167

Class

PagererPreset
Defines a Pagerer preset configuration entity.

Namespace

Drupal\pagerer\Entity

Code

public function unsetPaneData($pane, $key) {
  $e = explode('.', $key);
  $x =& $this->panes[$pane];
  for ($i = 0; $i < count($e) - 1; $i++) {
    if (!isset($x[$e[$i]])) {
      return $this;
    }
    $x =& $x[$e[$i]];
  }
  unset($x[$e[$i]]);
  return $this;
}