mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
updating form helper labels for multiple records, fixes #3880, updating custom acl component loading, #3875
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6358 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
aa7ca4e703
commit
edcdcf3235
3 changed files with 6 additions and 3 deletions
|
@ -49,7 +49,7 @@ class AclComponent extends Object {
|
|||
function __construct() {
|
||||
$name = Configure::read('Acl.classname');
|
||||
if (!class_exists($name)) {
|
||||
if (App::import('Component'. $name)) {
|
||||
if (App::import('Component', $name)) {
|
||||
if (strpos($name, '.') !== false) {
|
||||
list($plugin, $name) = explode('.', $name);
|
||||
}
|
||||
|
|
|
@ -397,12 +397,13 @@ class FormHelper extends AppHelper {
|
|||
*/
|
||||
function label($fieldName = null, $text = null, $attributes = array()) {
|
||||
if (empty($fieldName)) {
|
||||
$fieldName = implode('.', array_filter(array($this->model(), $this->field())));
|
||||
$view = ClassRegistry::getObject('view');
|
||||
$fieldName = implode('.', $view->entity());
|
||||
}
|
||||
|
||||
if ($text === null) {
|
||||
if (strpos($fieldName, '/') !== false || strpos($fieldName, '.') !== false) {
|
||||
list( , $text) = preg_split('/[\/\.]+/', $fieldName);
|
||||
$text = array_pop(preg_split('/[\/\.]+/', $fieldName));
|
||||
} else {
|
||||
$text = $fieldName;
|
||||
}
|
||||
|
|
|
@ -1460,6 +1460,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertPattern('/<input[^<>]+id="Contact1Id"[^<>]*>/', $result);
|
||||
|
||||
$result = $this->Form->input("1.name");
|
||||
$this->assertPattern('/<label\s+[^<>]+>Name<\/label[^<>]*>/', $result);
|
||||
$this->assertPattern('/<label[^<>]+for="Contact1Name"[^<>]*>/', $result);
|
||||
$this->assertPattern('/<input[^<>]+id="Contact1Name"[^<>]*>/', $result);
|
||||
|
||||
|
@ -1467,6 +1468,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertPattern('/<input[^<>]+id="Model1Id"[^<>]*>/', $result);
|
||||
|
||||
$result = $this->Form->input("Model.1.name");
|
||||
$this->assertPattern('/<label\s+[^<>]+>Name<\/label[^<>]*>/', $result);
|
||||
$this->assertPattern('/<label[^<>]+for="Model1Name"[^<>]*>/', $result);
|
||||
$this->assertPattern('/<input[^<>]+id="Model1Name"[^<>]*>/', $result);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue