Esempio n. 1
0
 public function addField($pointer, $field, array $options = [])
 {
     if ($this->hasField($pointer, $field)) {
         return false;
     }
     $options = ArrayHelper::merge(['name' => null, 'i18n' => false, 'alias' => null, 'plugins' => [], 'i18n' => false, 'extraField' => false], $options);
     // can not unshift non array value, create array for this pointer.
     if (empty($this->_config[$pointer])) {
         $this->_config[$pointer] = [];
     }
     $this->_config[$pointer] = ArrayHelper::arrayUnshiftAssoc($this->_config[$pointer], $field, $options);
     return true;
 }
Esempio n. 2
0
 public function getMenu()
 {
     if ($this->_menu === null) {
         $menu = [];
         $menus = Yii::$app->getModule('admin')->moduleMenus;
         foreach ($menus as $k => $v) {
             if (is_object($v) && $v instanceof AdminMenuBuilderInterface) {
                 $data = $v->menu();
             } else {
                 $data = $v;
             }
             $menu = ArrayHelper::merge($data, $menu);
         }
         $this->_menu = $menu;
     }
     return $this->_menu;
 }
Esempio n. 3
0
 public function copyFrom($key, $removeFields = [])
 {
     $temp = $this->config[$key];
     foreach ($removeFields as $name) {
         if (array_key_exists($name, $temp)) {
             unset($temp[$name]);
         }
     }
     $this->config[$this->pointer] = ArrayHelper::merge($this->config[$this->pointer], $temp);
 }
Esempio n. 4
0
 /**
  * Helper method to create a span tag with the ng-model in angular context for the crud overview
  * @param string $ngModel
  * @param array $options An array with options to pass to the list tag
  * @return string
  */
 public function createListTag($ngModel, array $options = [])
 {
     return $this->createTag('span', null, ArrayHelper::merge(['ng-bind' => $ngModel], $options));
 }
Esempio n. 5
0
 /**
  * Run Web-Application based on the provided config file.
  * 
  * @return string|void Returns the Yii Application run() method if mock is disabled. Otherwise returns void
  */
 public function applicationWeb()
 {
     $config = $this->getConfigArray();
     $this->includeYii();
     $this->app = new WebApplication(ArrayHelper::merge(['bootstrap' => ['luya\\web\\Bootstrap']], $config));
     if (!$this->mockOnly) {
         return $this->app->run();
     }
 }
 public function getExtraVarValues()
 {
     $this->_extraVars = ArrayHelper::merge($this->_extraVars, $this->extraVars());
     return $this->_extraVars;
 }