dropdownPage(); } else if ($type == 'content_id') { return $this->dropdownContent(); } return []; } //-------------------------------------// protected function dropdownPage(): array { $pages = PageModel::selectAll( '*', "WHERE `active` = ? ORDER BY `title` ASC", [1], '?'); return [0 => 'Select page'] + array_combine( array_column($pages, 'id'), array_column($pages, 'title') ); } protected function dropdownContent(): array { $contents = ContentModel::selectAll( '*', "WHERE `active` = ? ORDER BY `title` ASC", [1], '?'); // Exit if nothing was found if (!_exists($contents)) { return []; } return [0 => 'Select content'] + array_combine( array_column($contents, 'id'), array_column($contents, 'title') ); } }