mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
updating helpers for multiple records, fixes #3874
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6356 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
cbd715618b
commit
aeaeb97a49
3 changed files with 16 additions and 2 deletions
|
@ -466,7 +466,7 @@ class Helper extends Overloadable {
|
|||
return $this->domId();
|
||||
}
|
||||
|
||||
$dom = $this->model() . Inflector::camelize($view->field) . Inflector::camelize($view->fieldSuffix);
|
||||
$dom = $this->model() . $this->modelID() . Inflector::camelize($view->field) . Inflector::camelize($view->fieldSuffix);
|
||||
|
||||
if (is_array($options) && !array_key_exists($id, $options)) {
|
||||
$options[$id] = $dom;
|
||||
|
|
|
@ -610,7 +610,7 @@ class FormHelper extends AppHelper {
|
|||
if (isset($options['id'])) {
|
||||
$labelAttributes = array_merge($labelAttributes, array('for' => $options['id']));
|
||||
}
|
||||
$out = $this->label(null, $labelText, $labelAttributes);
|
||||
$out = $this->label($fieldName, $labelText, $labelAttributes);
|
||||
}
|
||||
|
||||
$error = null;
|
||||
|
|
|
@ -1455,6 +1455,20 @@ class FormHelperTest extends CakeTestCase {
|
|||
$result = $this->Form->input('Contact.name', array('div' => false, 'id' => 'my_id', 'label' => array('for' => 'my_id')));
|
||||
$this->assertPattern('/^<label for="my_id">Name<\/label>' .
|
||||
'<input name="data\[Contact\]\[name\]" type="text" id="my_id" maxlength="255" value="" \/>$/', $result);
|
||||
|
||||
$result = $this->Form->input('1.id');
|
||||
$this->assertPattern('/<input[^<>]+id="Contact1Id"[^<>]*>/', $result);
|
||||
|
||||
$result = $this->Form->input("1.name");
|
||||
$this->assertPattern('/<label[^<>]+for="Contact1Name"[^<>]*>/', $result);
|
||||
$this->assertPattern('/<input[^<>]+id="Contact1Name"[^<>]*>/', $result);
|
||||
|
||||
$result = $this->Form->input("Model.1.id");
|
||||
$this->assertPattern('/<input[^<>]+id="Model1Id"[^<>]*>/', $result);
|
||||
|
||||
$result = $this->Form->input("Model.1.name");
|
||||
$this->assertPattern('/<label[^<>]+for="Model1Name"[^<>]*>/', $result);
|
||||
$this->assertPattern('/<input[^<>]+id="Model1Name"[^<>]*>/', $result);
|
||||
}
|
||||
|
||||
function testFormEnd() {
|
||||
|
|
Loading…
Add table
Reference in a new issue