Skip to content

Commit

Permalink
fix обработка принудительных полей
Browse files Browse the repository at this point in the history
  • Loading branch information
smirnov-e committed Mar 17, 2020
1 parent 68e9179 commit ab69251
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions plugins/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Settings extends AbstractPlugin
public $activeColumns;

/** @var string[] */
public $forceColumns;
public $forceColumns = [];
/**
* @var string
*/
Expand Down Expand Up @@ -66,7 +66,6 @@ protected function initFromStorage()
if (isset($settings['columns'])) {
$this->activeColumns = $settings['columns'];
}
$this->activeColumns = array_merge($this->activeColumns, $this->forceColumns ?: []);
}
}

Expand Down Expand Up @@ -103,7 +102,10 @@ public function initColumns()
if (!empty($id) && !empty($label)) {
$this->columnLabels[$id] = $label;

if (is_array($this->activeColumns) && !in_array($id, $this->activeColumns)) {
if (is_array($this->activeColumns)
&& !in_array($id, $this->activeColumns)
&& !in_array($id, $this->forceColumns)
) {
unset($this->grid->columns[$key]);
}
}
Expand All @@ -112,6 +114,10 @@ public function initColumns()
if (!is_array($this->activeColumns)) {
$this->activeColumns = array_keys($this->columnLabels);
}

if ($this->forceColumns) {
$this->activeColumns = array_merge($this->activeColumns, $this->forceColumns);
}
}
}

Expand Down

0 comments on commit ab69251

Please # to comment.