/** * @param \Core\ORM_Fields_Abstract $field * @param \Core\ORM_Record $record */ public function __construct(\Core\ORM_Fields_Abstract $field, \Core\ORM_Record $record) { $this->field_name = $field->field_name; $this->field_label = $field->title; if ($record->fieldIsSet($field->field_name)) { $this->field_value = $record->getFieldValue($field->field_name); } }
/** * @param \Core\ORM_Fields_Abstract $field * @param \Core\ORM_Record $record */ public function __construct(\Core\ORM_Fields_Abstract $field, \Core\ORM_Record $record) { $this->field_name = $field->field_name; $this->field_label = $field->title; $field_name = $field->field_name; if ($record->Id && $record->fieldIsSet($field->field_name) && !empty($record->{$field_name}) && is_numeric($record->{$field_name})) { $this->field_value = date('Y-m-d H:i:s', $record->{$field_name}); } elseif (!$record->Id) { $this->field_value = date('Y-m-d H:i:s'); } }
public function setFields() { parent::setFields(); $this->fields[self::FIELD_SLUG] = new \Core\ORM_Fields_String($this, self::FIELD_SLUG, 'Адрес URL'); $this->fields[self::FIELD_HTML] = new \Core\ORM_Fields_Hidden($this, self::FIELD_HTML, self::FIELD_HTML); $this->fields[self::FIELD_TEXT] = new \Core\ORM_Fields_Markdown($this, self::FIELD_TEXT, 'Текст статьи', 'Текст статьи', null, self::FIELD_HTML); }