You are here

public function ExportData::deletePage in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/ExportData.php \AKlump\LoftDataGrids\ExportData::deletePage()

Delete a single page from the object

Parameters

mixed $page_id:

Return value

$this

Overrides ExportDataInterface::deletePage

File

vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/ExportData.php, line 280

Class

ExportData

Namespace

AKlump\LoftDataGrids

Code

public function deletePage($page_id) {
  unset($this->data[$page_id]);
  unset($this->keys[$page_id]);
  unset($this->current_pointers[$page_id]);

  // Reset the current page if it was on the deleted page
  if ($this->current_page == $page_id) {
    $this->current_page = reset($this
      ->getAllPageIds());
  }

  // Remove locations pointing to it
  foreach ($this->locations as $location_id => $stored) {
    if ($stored['page'] == $page_id) {
      unset($this->locations[$location_id]);
    }
    unset($this->locations[$location_id]['pointers'][$page_id]);
  }
  return $this;
}