/** * @param mixed $model * * @return string */ public function getTitle($model) { return $this->evaluate('title', $model) ?: Helpers::labelFromId($this->get('id')); }
/** * Generate a label from the id. * * @return string */ protected function generateLabel() { return Helpers::labelFromId($this->id); }
/** * Make title for specified plurality. * * @param string $plurality * * @return string */ protected function makeTitle($plurality) { $result = $this->translate("::{$this->id}.title.{$plurality}"); if ($result !== null) { return $result; } $result = $this->translate("::entities.titles.{$this->id}.{$plurality}"); if ($result !== null) { return $result; } $func = "str_{$plurality}"; return Helpers::labelFromId($func($this->id)); }