/** * Generates the label name for the given field name. * * @param string $name The field name * @return string The label name */ public function generateLabelName($name) { $label = parent::generateLabelName($name); $fields = $this->validatorSchema->getFields(); if ($fields[$name] != null) { $field = $fields[$name]; if ($label && $field->hasOption('required') && $field->getOption('required')) { $label .= $this->requiredTemplate; } } return $label; }
/** * If field is required append the required format to the label name * * @see parent */ public function generateLabelName($name) { $label = parent::generateLabelName($name); $validatorSchema = $this->getForm() ? $this->getForm()->getValidatorSchema() : null; if (!$this->getMarkRequired() || !$validatorSchema || !isset($validatorSchema[$name])) { return $label; } if ($validatorSchema[$name]->hasOption('required') && $validatorSchema[$name]->getOption('required') && !$validatorSchema[$name] instanceof sfValidatorSchema) { $label .= $this->requiredFormat; } return $label; }
public function generateLabelName($name) { $originalCallable = null; if (isset(self::$translationCallable[0]) && self::$translationCallable[0] instanceof opI18N) { $originalCallable = clone self::$translationCallable[0]; self::$translationCallable[0]->titleize = true; } $result = parent::generateLabelName($name); if ($originalCallable) { self::$translationCallable[0] = $originalCallable; } return $result; }