/** * Returns plural label for the content type. * @returns string Plural label for the content type. */ public function pluralLabel($count, $property_name = 'label') { return parent::pluralLabel($count, $property_name); }
/** * Validates form data collected by the object. * @throws ContentValidationException * @throws \Littled\Exception\NotImplementedException */ public function validateInput() { $form_errors = ''; try { parent::validateInput(); } catch (ContentValidationException $ex) { $form_errors .= $ex->getMessage(); } if ($this->id->value === null && $this->site_section_id->value > 0 && $this->name->value) { $this->connectToDatabase(); $table = self::TABLE_NAME(); $escaped_name = $this->name->escapeSQL($this->mysqli); $query = <<<SQL SELECT t.`id`, s.`name` as `section` FROM `{$table}` t INNER JOIN `site_section` s on t.site_section_id = s.id WHERE (t.site_section_id = {$this->site_section_id->value}) AND (t.`name` = {$escaped_name}); SQL; $id = 0; $data = $this->fetchRecords($query); if (count($data) > 0) { $id = $data[0]->id; $section = $data[0]->section; } if ($id > 0) { $form_errors .= "A template named \"{$this->name->value}\" already exists under {$section}. \n"; } } if ($form_errors) { throw new ContentValidationException($form_errors); } }