mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Added braces check for initDefaultButton (#12863)
This commit is contained in:

committed by
Alexander Makarov

parent
aa6d34a285
commit
d3c7accc49
@ -157,7 +157,7 @@ class ActionColumn extends Column
|
|||||||
*/
|
*/
|
||||||
protected function initDefaultButton($name, $iconName, $additionalOptions = [])
|
protected function initDefaultButton($name, $iconName, $additionalOptions = [])
|
||||||
{
|
{
|
||||||
if (!isset($this->buttons[$name]) && strpos($this->template, $name) !== false) {
|
if (!isset($this->buttons[$name]) && strpos($this->template, '{' . $name . '}') !== false) {
|
||||||
$this->buttons[$name] = function ($url, $model, $key) use ($name, $iconName, $additionalOptions) {
|
$this->buttons[$name] = function ($url, $model, $key) use ($name, $iconName, $additionalOptions) {
|
||||||
$title = Yii::t('yii', ucfirst($name));
|
$title = Yii::t('yii', ucfirst($name));
|
||||||
$options = array_merge([
|
$options = array_merge([
|
||||||
|
@ -24,6 +24,12 @@ class ActionColumnTest extends \yiiunit\TestCase
|
|||||||
|
|
||||||
$column = new ActionColumn(['template' => '{show} {edit} {remove}']);
|
$column = new ActionColumn(['template' => '{show} {edit} {remove}']);
|
||||||
$this->assertEmpty($column->buttons);
|
$this->assertEmpty($column->buttons);
|
||||||
|
|
||||||
|
$column = new ActionColumn(['template' => '{view-items} {update-items} {delete-items}']);
|
||||||
|
$this->assertEmpty($column->buttons);
|
||||||
|
|
||||||
|
$column = new ActionColumn(['template' => '{view} {view-items}']);
|
||||||
|
$this->assertEquals(['view'], array_keys($column->buttons));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRenderDataCell()
|
public function testRenderDataCell()
|
||||||
|
Reference in New Issue
Block a user