Grav\Plugin\Admin\AdminController::initialize PHP Метод

initialize() публичный Метод

public initialize ( Grav\Common\Grav $grav = null, string $view = null, string $task = null, string $route = null, array $post = null )
$grav Grav\Common\Grav
$view string
$task string
$route string
$post array
    public function initialize(Grav $grav = null, $view = null, $task = null, $route = null, $post = null)
    {
        $this->grav = $grav;
        $this->view = $view;
        $this->task = $task ? $task : 'display';
        if (isset($post['data'])) {
            $this->data = $this->getPost($post['data']);
            unset($post['data']);
        } else {
            // Backwards compatibility for Form plugin <= 1.2
            $this->data = $this->getPost($post);
        }
        $this->post = $this->getPost($post);
        $this->route = $route;
        $this->admin = $this->grav['admin'];
        $this->grav->fireEvent('onAdminControllerInit', new Event(['controller' => &$this]));
    }

Usage Example

Пример #1
0
 protected function initializeController($task, $post)
 {
     $controller = new AdminController();
     $controller->initialize($this->grav, $this->template, $task, $this->route, $post);
     $controller->execute();
     $controller->redirect();
 }