You are here

public function ExportData::hideKeys 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::hideKeys()

Disables one or more keys on the current page from get().

Parameters

bool||string Any number of arguments, which are keys to hide: from self::get(). The data remains in tact, it just will not be output in the getters. Send FALSE to clear out any previously hidden keys. Send TRUE and all keys for the current page will be hidden. This method takes the current page in to account; so it only hides the keys on the current page.

Return value

$this

Overrides ExportDataInterface::hideKeys

File

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

Class

ExportData

Namespace

AKlump\LoftDataGrids

Code

public function hideKeys() {
  $keys = func_get_args();

  // Boolean values sets all keys.
  if (count($keys) === 1 && is_bool($keys[0])) {

    // This is important, as it resets our property.
    if ($keys[0] === FALSE) {
      $this->hiddenKeys[$this->current_page] = array();
    }
    $keys = $keys[0] ? $this
      ->getKeys() : array();
  }
  if (!isset($this->hiddenKeys[$this->current_page])) {
    $this->hiddenKeys[$this->current_page] = array();
  }
  if ($keys) {
    $this->hiddenKeys[$this->current_page] += array_combine($keys, $keys);
  }
  return $this;
}