You are here

public function ExportData::add in Loft Data Grids 7.2

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

Add (or Set) data to the current record

Parameters

string $key:

string $value:

Return value

$this

Overrides ExportDataInterface::add

2 calls to ExportData::add()
ScheduleData::addStatsPage in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/ScheduleData.php
ScheduleData::addTodoItem in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/ScheduleData.php

File

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

Class

ExportData

Namespace

AKlump\LoftDataGrids

Code

public function add($key, $value) {
  $page = $this->current_page;
  if (empty($this->current_pointers[$page])) {
    $this->current_pointers[$page] = 0;
  }
  $row = $this->current_pointers[$page];
  if (!array_key_exists($page, $this->keys)) {
    $this->keys[$page] = array();
  }
  if (empty($this->data[$page][$row])) {
    $this->data[$page][$row] = array_fill_keys($this->keys[$page], null);
  }
  $this->data[$page][$row][$key] = $value;
  return $this;
}