mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'flash-plugin' into 2.7
Fixes the plugin option not working with `__call` on FlashComponent as documented. Fixes #7570
This commit is contained in:
commit
d220616b5a
2 changed files with 14 additions and 6 deletions
|
@ -76,13 +76,11 @@ class FlashComponent extends Component {
|
|||
$message = $message->getMessage();
|
||||
}
|
||||
|
||||
list($plugin, $element) = pluginSplit($options['element']);
|
||||
|
||||
if ($plugin) {
|
||||
$options['element'] = $plugin . '.Flash/' . $element;
|
||||
} else {
|
||||
$options['element'] = 'Flash/' . $element;
|
||||
list($plugin, $element) = pluginSplit($options['element'], true);
|
||||
if (!empty($options['plugin'])) {
|
||||
$plugin = $options['plugin'] . '.';
|
||||
}
|
||||
$options['element'] = $plugin . 'Flash/' . $element;
|
||||
|
||||
CakeSession::write('Message.' . $options['key'], array(
|
||||
'message' => $message,
|
||||
|
|
|
@ -158,6 +158,16 @@ class FlashComponentTest extends CakeTestCase {
|
|||
$result = CakeSession::read('Message.flash');
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$this->Flash->alert('It worked', array('plugin' => 'MyPlugin'));
|
||||
$expected = array(
|
||||
'message' => 'It worked',
|
||||
'key' => 'flash',
|
||||
'element' => 'MyPlugin.Flash/alert',
|
||||
'params' => array()
|
||||
);
|
||||
$result = CakeSession::read('Message.flash');
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$this->Flash->error('It did not work', array('element' => 'error_thing'));
|
||||
$expected = array(
|
||||
'message' => 'It did not work',
|
||||
|
|
Loading…
Reference in a new issue