mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing issues in JsHelper with PHP4 compatibility. Seems passing arrays by reference doesn't work very well.
This commit is contained in:
parent
b97ac84a34
commit
f1a0690415
2 changed files with 8 additions and 5 deletions
|
@ -299,7 +299,7 @@ class JsHelper extends AppHelper {
|
|||
if (!isset($options['id'])) {
|
||||
$options['id'] = 'link-' . intval(mt_rand());
|
||||
}
|
||||
$htmlOptions = $this->_getHtmlOptions($options);
|
||||
list($options, $htmlOptions) = $this->_getHtmlOptions($options);
|
||||
$out = $this->Html->link($title, $url, $htmlOptions);
|
||||
$this->get('#' . $htmlOptions['id']);
|
||||
$requestString = '';
|
||||
|
@ -366,7 +366,7 @@ class JsHelper extends AppHelper {
|
|||
$options['id'] = 'submit-' . intval(mt_rand());
|
||||
}
|
||||
$formOptions = array('div');
|
||||
$htmlOptions = $this->_getHtmlOptions($options, $formOptions);
|
||||
list($options, $htmlOptions) = $this->_getHtmlOptions($options, $formOptions);
|
||||
$out = $this->Form->submit($caption, $htmlOptions);
|
||||
|
||||
$this->get('#' . $htmlOptions['id']);
|
||||
|
@ -401,10 +401,10 @@ class JsHelper extends AppHelper {
|
|||
*
|
||||
* @param array $options Options to filter.
|
||||
* @param array $additional Array of additional keys to extract and include in the return options array.
|
||||
* @return array Array of options for non-js.
|
||||
* @return array Array of js options and Htmloptions
|
||||
* @access public
|
||||
*/
|
||||
function _getHtmlOptions(&$options, $additional = array()) {
|
||||
function _getHtmlOptions($options, $additional = array()) {
|
||||
$htmlKeys = array_merge(array('class', 'id', 'escape', 'onblur', 'onfocus', 'rel', 'title'), $additional);
|
||||
$htmlOptions = array();
|
||||
foreach ($htmlKeys as $key) {
|
||||
|
@ -417,7 +417,7 @@ class JsHelper extends AppHelper {
|
|||
$htmlOptions = array_merge($htmlOptions, $options['htmlAttributes']);
|
||||
unset($options['htmlAttributes']);
|
||||
}
|
||||
return $htmlOptions;
|
||||
return array($options, $htmlOptions);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -279,6 +279,9 @@ class JsHelperTestCase extends CakeTestCase {
|
|||
|
||||
@unlink(WWW_ROOT . $filename[1]);
|
||||
}
|
||||
function getTests() {
|
||||
return array('start', 'startCase', 'testLinkWithMock', 'endCase', 'end');
|
||||
}
|
||||
|
||||
/**
|
||||
* test link()
|
||||
|
|
Loading…
Reference in a new issue