Esempio n. 1
0
 /**
  * @param array $fields
  * @param string $sheetTitle
  * @return array
  */
 private function formFieldsForXml($fields, $sheetTitle)
 {
     $fieldsArrayCounter = 0;
     $fieldsArray = array();
     foreach ($fields as $field) {
         foreach ($field as $key => $value) {
             $formValuesForXml = $this->formValuesForXml($value);
             $fieldsArray[$fieldsArrayCounter] = array('name' => 'settings.' . $key, 'value' => array(array('name' => 'TCEforms', 'value' => $formValuesForXml)));
             foreach ($fieldsArray[$fieldsArrayCounter]['value'] as $key1 => $value1) {
                 if (is_array($value1)) {
                     if ($value1['name'] == 'label') {
                         $fieldsArray[$fieldsArrayCounter]['value'][$key1]['value'] = $this->conf->getLl() . '.' . $sheetTitle . '.' . $key;
                     }
                 }
             }
             $fieldsArrayCounter++;
         }
     }
     return $fieldsArray;
 }
Esempio n. 2
0
 /**
  * @param string $fieldName
  * @param array $items
  * @param string $label
  * @param string $itemsLabelPath
  * @param int $exclude
  * @return array
  */
 public function addSelectField($fieldName, $items = array(), $label = '', $itemsLabelPath = '', $exclude = 0)
 {
     if (empty($itemsLabelPath)) {
         $itemsLabelPath = $this->conf->getLl();
     }
     if (empty($label)) {
         $label = $this->getFieldLabel($fieldName);
     }
     $itemsArr = array();
     foreach ($items as $item) {
         $itemsArr[] = array($itemsLabelPath . '.' . $item['name'], $item['value']);
     }
     $this->fields[$fieldName] = array('exclude' => $exclude, 'label' => $label, 'config' => array('type' => 'select', 'items' => $itemsArr));
     return array($fieldName => $this->fields[$fieldName]);
 }