public function __construct(&$field) { parent::__construct($field); if ($this->method == 'fixed') { $this->editable = true; $this->editLimit = 5; } if ($this->method == 'fixed' && in_array(SPRequest::task(), array('entry.add', 'entry.edit'))) { $this->isOutputOnly = true; } if ($this->method == 'fixed') { $this->editable = true; } }
/** * @return array */ public function struct() { if (!$this->dependency) { return parent::struct(true); } $selected = $this->getRaw(); if (isset($this->_fData->options)) { $path = SPConfig::unserialize($this->_fData->options); } else { return null; } $selectedPath = array(); $options = json_decode(SPFs::read(SOBI_PATH . '/etc/fields/select-list/definitions/' . str_replace('.xml', '.json', $this->dependencyDefinition)), true); if (isset($options['translation'])) { SPLang::load($options['translation']); $selected = Sobi::Txt(strtoupper($options['prefix']) . '.' . strtoupper($selected)); } if (count($path) && isset($options['translation'])) { foreach ($path as $step) { $selectedPath[$step] = $selected = Sobi::Txt(strtoupper($options['prefix']) . '.' . strtoupper($step)); } } $this->cleanCss(); return array('_complex' => 1, '_data' => $selected, '_attributes' => array('class' => $this->cssClass), '_options' => array('path' => count($selectedPath) ? $selectedPath : $path)); }