public function getJsField($content) { parent::getJsField($content); if (isset($this['format']) && isset($this['format']['html']) && $this['format']['html']) { $this->_js_field['wysiwyg'] = true; $this->_js_field['nl2br'] = $this['format']['nl2br']; } return $this->_js_field; }
public function getJsField($content) { parent::getJsField($content); $this->_js_field['values'] = $this->getSelectValues(); if ($this->format['show'] == 'radio') { $this->_js_field['type'] = 'radio'; } $this->_js_field['value'] = $content[$this['keyword']]; return $this->_js_field; }
public function getJsField($content) { parent::getJsField($content); $this->_js_field['type'] = 'file'; $this->_js_field['field_id'] = $this['id']; $val = $this->_js_field['value']; $abs = fx::path()->abs($val); if (fx::path()->exists($abs)) { $this->_js_field['value'] = array('path' => $val, 'filename' => fx::path()->fileName($abs), 'size' => fx::files()->readableSize($abs)); } return $this->_js_field; }
protected function beforeSave() { if ($this->isModified('format') || !$this['id']) { $c_lf = $this['format']['linking_field']; $c_ldt = $this['format']['linking_field_' . $c_lf . '_datatype']; if ($c_ldt) { $format = array('render_type' => $this['format']['render_type'], 'linking_field' => $c_lf); $format['linking_datatype'] = $c_ldt; $mm_field = $this['format']['linking_mm_field_' . $c_lf . '_' . $c_ldt]; if ($mm_field) { $format['mm_field'] = $mm_field; $format['mm_datatype'] = $this['format']['linking_mm_type_' . $c_lf . '_' . $c_ldt . '_' . $mm_field]; } $this['format'] = $format; } $this['format'] = $format; } parent::beforeSave(); }
public function getSavestring($content) { if (is_array($this->value) && isset($this->value['title'])) { $title = $this->value['title']; $entity_infoblock_id = isset($this->value['infoblock_id']) ? $this->value['infoblock_id'] : $content->getLinkFieldInfoblock($this['id']); $entity_params = array('name' => $title); $entity_infoblock = null; if ($entity_infoblock_id) { $entity_infoblock = fx::data('infoblock', $entity_infoblock_id); if ($entity_infoblock) { $entity_params += array('infoblock_id' => $entity_infoblock_id, 'parent_id' => $entity_infoblock['page_id']); } } if (isset($this->value['parent_id'])) { $entity_params['parent_id'] = $this->value['parent_id']; } $rel = $this->getRelation(); $entity_type = isset($this->value['type']) ? $this->value['type'] : $rel[1]; $entity = fx::data($entity_type)->create($entity_params); $entity_prop_name = $this['format']['prop_name']; $content[$entity_prop_name] = $entity; return false; } return parent::getSavestring(); }