Example #1
0
 /**
  * @param mixed $model
  *
  * @return string
  */
 public function getTitle($model)
 {
     return $this->evaluate('title', $model) ?: Helpers::labelFromId($this->get('id'));
 }
Example #2
0
 /**
  * Generate a label from the id.
  *
  * @return string
  */
 protected function generateLabel()
 {
     return Helpers::labelFromId($this->id);
 }
Example #3
0
 /**
  * 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));
 }