Skip to content
Permalink
Browse files

fixes #3010 problem with detailview callables

  • Loading branch information...
cebe committed Jan 28, 2014
1 parent 86547f5 commit 7c4ee0b10b53f52c00ea873de1529dce9b2b5273
Showing with 9 additions and 2 deletions.
  1. +1 −0 CHANGELOG
  2. +4 −0 UPGRADE
  3. +4 −2 framework/zii/widgets/CDetailView.php
@@ -24,6 +24,7 @@ Version 1.1.15 under development
- Bug #2959: Fixed CFileValidator to encode file name, while composing error messages (klimov-paul)
- Bug #2963: CAssetManager::generatePath no longer uses basename for hasing (eirikhm)
- Bug #2970: Fixed Active Record may join same relation twice on eager loading. (klimov-paul)
- Bug #3010: Problem with callables given as values to CDetailView. CDetailView now only allows annonymous functions to be called, all other values will be taken as value (cebe)
- Bug #3064: Fixed problem with array to string converion in CDbMigration methods that accept array parameters (cebe)
- Bug #3134: Fixed the issue that query cache returns the same data for the same SQL but different query methods (qiangxue)
- Bug #3144: It wasn't possible to use attributes with spaces in validation rules (samdark)
@@ -23,6 +23,10 @@ Upgrading from v1.1.14
- CErrorHandler now runs errorAction for errors, which appear via AJAX request.
If you use CErrorHandler::errorAction, make sure it handles AJAX request properly.

- The possibility to use callables for values of CDetailView introduced a problem with string beeing interpreted as
PHP functions. CDetailView now only allows anonymous functions to be called, all other values will be taken as value.


Upgrading from v1.1.13
----------------------

@@ -77,7 +77,9 @@ class CDetailView extends CWidget
* If the below "value" element is specified, this will be ignored.</li>
* <li>value: the value to be displayed. If this is not specified, the above "name" element will be used
* to retrieve the corresponding attribute value for display. Note that this value will be formatted according
* to the "type" option as described below.</li>
* to the "type" option as described below. This can also be an anonymous function whose return value will be
* used as a value. The signature of the function should be <code>function($data)</code> where data refers to
* the {@link data} property of the detail view widget.</li>
* <li>type: the type of the attribute that determines how the attribute value would be formatted.
* Please see above for possible values.
* <li>cssClass: the CSS class to be used for this item. This option is available since version 1.1.3.</li>
@@ -209,7 +211,7 @@ public function run()
if(!isset($attribute['type']))
$attribute['type']='text';
if(isset($attribute['value']))
$value=is_callable($attribute['value']) ? call_user_func($attribute['value'],$this->data) : $attribute['value'];
$value=($attribute['value'] instanceof Closure) ? call_user_func($attribute['value'],$this->data) : $attribute['value'];
elseif(isset($attribute['name']))
$value=CHtml::value($this->data,$attribute['name']);
else

0 comments on commit 7c4ee0b

Please sign in to comment.
You can’t perform that action at this time.