You are here

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

Inverse of hideKeys.

To hide all but one column (key) you would do this:

$obj
  ->hideKeys(TRUE)
  ->showKeys('Column1')
  ->getPage();

Return value

[type] [description]

Overrides ExportDataInterface::showKeys

File

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

Class

ExportData

Namespace

AKlump\LoftDataGrids

Code

public function showKeys() {
  $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] === TRUE) {
      $this->hiddenKeys[$this->current_page] = array();
    }
    $keys = $keys[0] ? array() : $this
      ->getKeys();
  }
  if (!isset($this->hiddenKeys[$this->current_page])) {
    $this->hiddenKeys[$this->current_page] = array();
  }
  if ($keys) {
    $this->hiddenKeys[$this->current_page] = array_diff($this->hiddenKeys[$this->current_page], $keys);
  }
  return $this;
}