Grido\Components\Actions\Action::__construct PHP Méthode

__construct() public méthode

public __construct ( Grid $grid, string $name, string $label )
$grid Grido\Grid
$name string
$label string
    public function __construct($grid, $name, $label)
    {
        $this->addComponentToGrid($grid, $name);
        $this->type = get_class($this);
        $this->label = $this->translate($label);
    }

Usage Example

Exemple #1
0
 /**
  * @param \Grido\Grid $grid
  * @param string $name
  * @param string $label
  * @param callable $onClick
  * @throws Exception
  */
 public function __construct($grid, $name, $label, $onClick = NULL)
 {
     parent::__construct($grid, $name, $label);
     if ($onClick === NULL) {
         $grid->onRender[] = function (Grid $grid) {
             if ($this->onClick === NULL) {
                 throw new Exception("Callback onClick in action '{$this->name}' must be set.");
             }
         };
     } else {
         $this->setOnClick($onClick);
     }
 }