/**
  * @param array $settings
  *
  * @return string
  */
 public function renderForm($settings)
 {
     if ($this->params->getAdminTemplate() === false) {
         return '';
     }
     return $this->renderer->render($this->params->getAdminTemplate(), ['wpWidget' => $this->wpWidget, 'settings' => $settings]);
 }
 /**
  * @param array $arguments
  *
  * @return bool | string
  */
 public function invoke(array $arguments)
 {
     if (count($arguments) < 1) {
         throw new RuntimeException("You have to define a path to the template");
     }
     if (array_key_exists(1, $arguments) && is_array($arguments[1])) {
         return $this->renderer->render($arguments[0], $arguments[1]);
     } else {
         return $this->renderer->render($arguments[0]);
     }
 }
 /**
  * @return void
  */
 protected function createSelectBox()
 {
     $file = __FILE__;
     $render = \Closure::bind(function ($object, $box) use($file) {
         echo $this->viewRenderer->render('admin/script/custom-fields/controller-page-mapping-field-box.phtml', ['object' => $object, 'box' => $box, 'file' => $file, 'name' => $this->name, 'readAllControllersFromFS' => \Closure::bind(function () {
             return $this->readAllControllersFromFS();
         }, $this), 'fieldName' => $this->fieldName]);
     }, $this);
     add_meta_box($this->fieldName . '-select', $this->name, $render, 'page', 'normal', 'high');
     add_meta_box($this->fieldName . '-select', $this->name, $render, 'post', 'normal', 'high');
 }
 /**
  * @param array $arguments
  *
  * @return mixed
  */
 public function invoke(array $arguments)
 {
     $script = '';
     $args = [];
     if (!empty($arguments[0])) {
         switch ($arguments[0]) {
             case 'header':
                 $script = 'layout/header.phtml';
                 break;
             case 'footer':
                 $script = 'layout/footer.phtml';
                 break;
             default:
                 $script = 'layout/' . $arguments[0] . '.phtml';
                 break;
         }
     } else {
         throw new RuntimeException('First argument must be name of the layout, empty given .');
     }
     if (!empty($arguments[1]) && is_array($arguments[1])) {
         $args = $arguments[1];
     }
     return $this->renderer->render($script, $args);
 }