/** * Set up options on single field depending on form options * * @param string $name * @param $options */ protected function setupFieldOptions($name, &$options) { $options['real_name'] = $name; if (!$this->getName()) { return; } if (!isset($options['label'])) { $options['label'] = $this->formHelper->formatLabel($name); } }
protected function setupLabel() { if ($this->getOption('label') !== null) { return; } if ($langName = $this->parent->getLanguageName()) { $label = sprintf('%s.%s', $langName, $this->getRealName()); } else { $label = $this->getRealName(); } $this->setOption('label', $this->formHelper->formatLabel($label)); }
/** * Defaults used across all fields * * @return array */ private function allDefaults() { return [ 'wrapper' => ['class' => $this->formHelper->getConfig('defaults.wrapper_class')], 'attr' => ['class' => $this->formHelper->getConfig('defaults.field_class')], 'help_block' => ['text' => null, 'tag' => 'p', 'attr' => [ 'class' => $this->formHelper->getConfig('defaults.help_block_class') ]], 'value' => null, 'default_value' => null, 'label' => $this->formHelper->formatLabel($this->getRealName()), 'is_child' => false, 'label_attr' => ['class' => $this->formHelper->getConfig('defaults.label_class'), 'for' => $this->name], 'errors' => ['class' => $this->formHelper->getConfig('defaults.error_class')] ]; }
/** * Get the title, used for validating a rule * * @param string $rule * @param array $params * @return string */ protected function getTitle($rule, $params = array()) { $params['attribute'] = $this->formHelper->formatLabel($this->field->getName()); return trans('validation.' . $rule, $params); }