Esempio n. 1
0
 /**
  * Get any configuration fields associated with the Inputfield
  *
  * @return InputfieldWrapper
  *
  */
 public function ___getConfigInputfields()
 {
     $wrapper = new InputfieldWrapper();
     $fieldgroupContext = $this->flags & Field::flagFieldgroupContext;
     if (!$fieldgroupContext) {
         $inputfields = new InputfieldWrapper();
         $inputfields->head = $this->_('Field type details');
         $inputfields->attr('title', $this->_('Details'));
         try {
             $fieldtypeInputfields = $this->type->getConfigInputfields($this);
             if ($fieldtypeInputfields) {
                 foreach ($fieldtypeInputfields as $inputfield) {
                     $inputfields->append($inputfield);
                 }
             }
         } catch (Exception $e) {
             $this->error($e->getMessage());
         }
         if (count($inputfields)) {
             $wrapper->append($inputfields);
         }
     } else {
         // we currently exclude fieldtype configuration changes when in fieldgroup context
         // not sure that we need to, but keeping it simple to start
     }
     $inputfields = new InputfieldWrapper();
     $dummyPage = $this->fuel('pages')->get("/");
     // only using this to satisfy param requirement
     if ($inputfield = $this->getInputfield($dummyPage)) {
         if (!$fieldgroupContext) {
             $inputfields->head = $this->_('Input field settings');
         }
         $inputfields->attr('title', $this->_('Input'));
         $inputfieldInputfields = $inputfield->getConfigInputfields();
         if ($inputfieldInputfields) {
             foreach ($inputfieldInputfields as $i) {
                 // currently we only support collapsed and columnWidth for fieldgroup context
                 // however we may support everything after starting with these limited options for awhile
                 if ($fieldgroupContext && !in_array($i->name, array('visibility', 'collapsed', 'columnWidth', 'required', 'requiredIf', 'showIf'))) {
                     continue;
                 }
                 $inputfields->append($i);
             }
         }
     }
     $wrapper->append($inputfields);
     return $wrapper;
 }
Esempio n. 2
0
 /**
  * Get any configuration fields associated with the Inputfield
  *
  * @return InputfieldWrapper
  *
  */
 public function ___getConfigInputfields()
 {
     $wrapper = new InputfieldWrapper();
     $fieldgroupContext = $this->flags & Field::flagFieldgroupContext;
     if ($fieldgroupContext) {
         $allowContext = $this->type->getConfigAllowContext($this);
         if (!is_array($allowContext)) {
             $allowContext = array();
         }
     } else {
         $allowContext = array();
     }
     if (!$fieldgroupContext || count($allowContext)) {
         $inputfields = new InputfieldWrapper();
         if (!$fieldgroupContext) {
             $inputfields->head = $this->_('Field type details');
         }
         $inputfields->attr('title', $this->_('Details'));
         try {
             $fieldtypeInputfields = $this->type->getConfigInputfields($this);
             if (!$fieldtypeInputfields) {
                 $fieldtypeInputfields = new InputfieldWrapper();
             }
             $configArray = $this->type->getConfigArray($this);
             if (count($configArray)) {
                 $w = new InputfieldWrapper();
                 $w->importArray($configArray);
                 $w->populateValues($this);
                 $fieldtypeInputfields->import($w);
             }
             foreach ($fieldtypeInputfields as $inputfield) {
                 if ($fieldgroupContext && !in_array($inputfield->name, $allowContext)) {
                     continue;
                 }
                 $inputfields->append($inputfield);
             }
         } catch (Exception $e) {
             $this->trackException($e, false, true);
         }
         if (count($inputfields)) {
             $wrapper->append($inputfields);
         }
     }
     $inputfields = new InputfieldWrapper();
     $dummyPage = $this->wire('pages')->get("/");
     // only using this to satisfy param requirement
     if ($inputfield = $this->getInputfield($dummyPage)) {
         if ($fieldgroupContext) {
             $allowContext = array('visibility', 'collapsed', 'columnWidth', 'required', 'requiredIf', 'showIf');
             $allowContext = array_merge($allowContext, $inputfield->getConfigAllowContext($this));
         } else {
             $allowContext = array();
             $inputfields->head = $this->_('Input field settings');
         }
         $inputfields->attr('title', $this->_('Input'));
         $inputfieldInputfields = $inputfield->getConfigInputfields();
         if (!$inputfieldInputfields) {
             $inputfieldInputfields = new InputfieldWrapper();
         }
         $configArray = $inputfield->getConfigArray();
         if (count($configArray)) {
             $w = new InputfieldWrapper();
             $w->importArray($configArray);
             $w->populateValues($this);
             $inputfieldInputfields->import($w);
         }
         foreach ($inputfieldInputfields as $i) {
             if ($fieldgroupContext && !in_array($i->name, $allowContext)) {
                 continue;
             }
             $inputfields->append($i);
         }
     }
     $wrapper->append($inputfields);
     return $wrapper;
 }
Esempio n. 3
0
 /**
  * Get any configuration fields associated with the Inputfield
  *
  * @return InputfieldWrapper
  *
  */
 public function ___getConfigInputfields()
 {
     $wrapper = new InputfieldWrapper();
     $inputfields = new InputfieldWrapper();
     $inputfields->head = "Field type details";
     $inputfields->attr('title', 'Details');
     $fieldtypeInputfields = $this->type->getConfigInputfields($this);
     if ($fieldtypeInputfields) {
         foreach ($fieldtypeInputfields as $inputfield) {
             $inputfields->append($inputfield);
         }
     }
     if (count($inputfields)) {
         $wrapper->append($inputfields);
     }
     $inputfields = new InputfieldWrapper();
     $dummyPage = $this->fuel('pages')->get("/");
     // only using this to satisfy param requirement
     if ($inputfield = $this->getInputfield($dummyPage)) {
         $inputfieldLabel = $inputfield->className();
         $inputfields->head = "Input field settings";
         $inputfields->attr('title', 'Input');
         $inputfieldInputfields = $inputfield->getConfigInputfields();
         if ($inputfieldInputfields) {
             foreach ($inputfieldInputfields as $i) {
                 $inputfields->append($i);
             }
         }
     }
     $wrapper->append($inputfields);
     return $wrapper;
 }