diff --git a/lib/TTCrud/TTCrud.php b/lib/TTCrud/TTCrud.php index 7c963e1c3..daca7bbcc 100644 --- a/lib/TTCrud/TTCrud.php +++ b/lib/TTCrud/TTCrud.php @@ -84,21 +84,19 @@ class TTCrud extends mfBaseController { * @return array */ protected function getCrudConfig(): array { - if (method_exists($this, 'prepareCrudConfig')) { - $this->prepareCrudConfig(); - } + $column = array_search('createBy', array_column($this->columns, 'key')); - if ($column !== false && - isset($this->columns[$column]['modal']['items']) && - is_array($this->columns[$column]['modal']['items']) && - count($this->columns[$column]['modal']['items']) > 0 - ) { + if ($column !== false) { $this->columns[$column]['modal']['items'] = array_map(function ($user) { return ['value' => intval($user->id), 'text' => $user->name]; }, UserModel::search(['employee' => true])); } + if (method_exists($this, 'prepareCrudConfig')) { + $this->prepareCrudConfig(); + } + $columns = array_map(function ($column) { if (isset($column['type']) && (!isset($column['modal']) || !isset($column['modal']['type']))) {