dropdownSection(); } else if ($type == 'content_id') { return $this->dropdownContent(); } return []; } //-------------------------------------// protected function dropdownSection(): array { $sections = SectionModel::selectAll( '*', "WHERE `active` = ? ORDER BY `title` ASC", [1], '?'); return [0 => 'Select section'] + array_combine( array_column($sections, 'id'), array_column($sections, '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') ); } }