type = 0; } // Generate the dropdown data public function getDropdownData(string $type): array { if ($type == 'section_id') { return $this->dropdownSection(); } return []; } public function delete(): bool { if (self::query( "DELETE FROM `{$this->table}_has_content` WHERE `{$this->table}_$this->primaryKey` = :id", [ [':id', $this->{$this->primaryKey}], ] ) === null) { return false; } return $this->deleteLog(); } //-------------------------------------// protected function dropdownSection(): array { // Pull sections from cache $sections = Db::getSections(); return [0 => 'Select section'] + array_combine( array_column($sections, 'id'), array_column($sections, 'title') ); } }