Closed nicodmf closed 10 years ago
I have no time to commit
But theres changes works :
<?php //in ZfTable\Decorator\DecoratorPluginManager class DecoratorPluginManager extends AbstractPluginManager { protected $invokableClasses = array( /*...*/ 'cellcallable' => '\ZfTable\Decorator\Cell\CallableDecorator', /*...*/ ); /*...*/ }
And the new file :
<?php namespace ZfTable\Decorator\Cell; /** * Description of CallableDecorator * * @author Nicolas de Marqué <nicolas.demarque@gmail.com> */ class CallableDecorator extends AbstractCellDecorator { protected $callable; public function __construct( callable $callable) { $this->callable = $callable; } public function render( $value ) { $values = array(); $actualRow = $this->getCell()->getActualRow(); return call_user_func_array($this->callable, array($value, $actualRow)); } }
The call is consequently :
<?php $this->getHeader( 'template' )->getCell()->addDecorator( 'callable', function($value, $values) { return $v . $values['anotherfield'] . "called"; });
Thanks for your plugin very usefull :)
Thanks for your proposition. It's added to 3.0 branch.
I have no time to commit
But theres changes works :
And the new file :
The call is consequently :
Thanks for your plugin very usefull :)