mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 19:38:26 +00:00
updating formHelper label to only translate text if the default is used, closes #2314
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6184 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
ac4896fabd
commit
87b33dc12a
1 changed files with 8 additions and 6 deletions
|
@ -329,7 +329,7 @@ class FormHelper extends AppHelper {
|
||||||
$this->fields[$model][$this->field()] = $options;
|
$this->fields[$model][$this->field()] = $options;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if((isset($this->fields[$model]) && !in_array($this->field(), $this->fields[$model], true)) || !isset($this->fields[$model])) {
|
if ((isset($this->fields[$model]) && !in_array($this->field(), $this->fields[$model], true)) || !isset($this->fields[$model])) {
|
||||||
$this->fields[$model][] = $this->field();
|
$this->fields[$model][] = $this->field();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -408,6 +408,10 @@ class FormHelper extends AppHelper {
|
||||||
$text = substr($text, 0, strlen($text) - 3);
|
$text = substr($text, 0, strlen($text) - 3);
|
||||||
}
|
}
|
||||||
$text = Inflector::humanize(Inflector::underscore($text));
|
$text = Inflector::humanize(Inflector::underscore($text));
|
||||||
|
|
||||||
|
if (!empty($text)) {
|
||||||
|
$text = __($text, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($attributes['for'])) {
|
if (isset($attributes['for'])) {
|
||||||
|
@ -416,9 +420,7 @@ class FormHelper extends AppHelper {
|
||||||
} else {
|
} else {
|
||||||
$labelFor = $this->domId($fieldName);
|
$labelFor = $this->domId($fieldName);
|
||||||
}
|
}
|
||||||
if (!empty($text)) {
|
|
||||||
$text = __($text, true);
|
|
||||||
}
|
|
||||||
return $this->output(sprintf($this->Html->tags['label'], $labelFor, $this->_parseAttributes($attributes), $text));
|
return $this->output(sprintf($this->Html->tags['label'], $labelFor, $this->_parseAttributes($attributes), $text));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -522,7 +524,7 @@ class FormHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->model() === $this->field()) {
|
if ($this->model() === $this->field()) {
|
||||||
$options['type'] = 'select';
|
$options['type'] = 'select';
|
||||||
if (!isset($options['multiple'])) {
|
if (!isset($options['multiple'])) {
|
||||||
$options['multiple'] = 'multiple';
|
$options['multiple'] = 'multiple';
|
||||||
|
@ -1487,7 +1489,7 @@ class FormHelper extends AppHelper {
|
||||||
|
|
||||||
list($name) = array_values($this->__name());
|
list($name) = array_values($this->__name());
|
||||||
|
|
||||||
if(empty($attributes['class'])) {
|
if (empty($attributes['class'])) {
|
||||||
$attributes['class'] = 'checkbox';
|
$attributes['class'] = 'checkbox';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue