Document parameters order for PHP 5.3 closures in CButtonColumn::$cssClassExpression #1885

Closed
undsoft opened this Issue Dec 23, 2012 · 4 comments

Comments

2 participants
Contributor

undsoft commented Dec 23, 2012

Hi,

Yii passes 3 variables to expressions in CGridView. Usually they are: $data (current model), $row (zero based row index) and $this (column object).

The problem is that when you use php5.3 parameter ordering is wrong.

This is the valid code. Mind parameter ordering.

array(
    'class'=>'CButtonColumn',
    'template'=>'{update}',

    'cssClassExpression'=>function($row, $data, $this){

    },
    'updateButtonUrl'=>function($data, $row, $this){

    },
}
Owner

samdark commented Dec 23, 2012

Unfortunitely, we can't fix it becaue it will break backwards compatibility.

samdark closed this Dec 23, 2012

Contributor

undsoft commented Dec 23, 2012

Can we at least mention this in documentation?

Owner

samdark commented Dec 24, 2012

Sure. Where exactly?

Contributor

undsoft commented Dec 24, 2012

CButtonColumn

$viewButtonUrl,
$updateButtonUrl,
$deleteButtonUrl

and probably in $buttons['visible']

It says now:

In this expression, the variable $row the row number (zero-based); $data the data model for the row; and $this the column object.

Probably should mention variables in the different order.

samdark reopened this Dec 24, 2012

samdark closed this Nov 17, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment