/** * For page render */ public function viewAction() { $id = _get('id'); $row = $this->getModel('page')->find($id); $page = $row->toArray(); $page['module'] = $this->getModule(); $form = new BaseForm(); $form->add(array('name' => 'tag', 'type' => 'tag')); $this->view()->assign('form', $form); $this->view()->assign('page', $page); $this->view()->setTemplate('page-content'); }
/** * {@inheritDoc} */ public function isValid() { foreach ($this->configs as $config) { $this->addFilter($config); } return parent::isValid(); }
/** * Constructor * * @param null|string|int $name Optional name for the element * @param string $markup Page type: text, html, markdown */ public function __construct($name = null, $markup = null) { $name = $name ?: 'comment-post'; $this->markup = $markup ?: $this->markup; parent::__construct($name); $this->setAttribute('action', Pi::service('comment')->getUrl('submit')); }
public function __construct($name = null, $option = array()) { $this->option = $option; $this->thumbUrl = isset($option['thumbUrl']) ? $option['thumbUrl'] : ''; $this->removeUrl = isset($option['removeUrl']) ? $option['removeUrl'] : ''; $this->module = Pi::service('module')->current(); parent::__construct($name); }
/** * Constructor * * @param string $name * @param array $config */ public function __construct($name, array $config = array()) { if (!$config) { $config = Pi::user()->config(); } $this->config = $config; parent::__construct($name); }
public function isValid() { $inputFilter = $this->getInputFilter(); $inputFilter->add(array('name' => 'title', 'filters' => array(array('name' => 'StringTrim')))); $inputFilter->add(array('name' => 'name', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(new WidgetNameDuplicate()))); $inputFilter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $inputFilter->add(array('name' => 'id', 'required' => true, 'allow_empty' => true)); $inputFilter->add(array('name' => 'content', 'required' => true, 'allow_empty' => false)); $inputFilter->add(array('name' => 'type', 'required' => true, 'allow_empty' => true)); return parent::isValid(); }
/** * Initialize object * * @param string $name Form name * @param array $options Optional parameters */ public function __construct($name, $options = array()) { if (isset($options['mode'])) { $this->mode = $options['mode']; } if (Config::FORM_MODE_CUSTOM == $this->mode) { $this->items = isset($options['elements']) ? $options['elements'] : array(); } elseif (!empty($options['elements'])) { $this->items = $options['elements']; } else { $this->items = $this->getDefaultElements($this->mode); } parent::__construct($name); }
public function __construct($name = null) { parent::__construct($name); }
public function __construct($name, $fields) { $this->fields = $fields; $this->name = $name; parent::__construct($this->name); }
public function __construct($name = null, $option = array()) { $this->option = $option; parent::__construct($name); }
/** * Constructor * * @param null|string|int $name Optional name for the element * @param Account $user User account row */ public function __construct($name = null, $user = null) { $this->user = $user; parent::__construct($name); }
/** * {@inheritDoc} */ public function isValid() { $inputFilter = $this->getInputFilter(); $inputFilter->add(array('name' => 'title', 'filters' => array(array('name' => 'StringTrim')))); $inputFilter->add(array('name' => 'name', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(new \Module\System\Validator\BlockNameDuplicate()))); $inputFilter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $inputFilter->add(array('name' => 'subline', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $inputFilter->add(array('name' => 'class', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $inputFilter->add(array('name' => 'cache_ttl', 'required' => false)); $inputFilter->add(array('name' => 'cache_level', 'required' => false)); $inputFilter->add(array('name' => 'id', 'allow_empty' => true)); $inputFilter->add(array('name' => 'root', 'required' => true, 'allow_empty' => true)); $inputFilter->add(array('name' => 'title_hidden', 'required' => true, 'allow_empty' => true)); $inputFilter->add(array('name' => 'body_fullsize', 'required' => true, 'allow_empty' => true)); $this->addConfigFilter($inputFilter); return parent::isValid(); }
/** * Constructor * * @param null|string|int $name Optional name for the form * @param string $section */ public function __construct($name = null, $section = 'front') { $this->section = $section; parent::__construct($name); }
/** * Constructor * * @param null|string|int $name Optional name for the form * @param array $user User account data */ public function __construct($name = null, $user = array()) { $this->user = array_merge($this->user, $user); parent::__construct($name); }
/** * {@inheritDoc} * * Canonize compound data */ public function getData($flags = FormInterface::VALUES_NORMALIZED) { $data = parent::getData($flags); $result = array(); foreach ($data as $key => $value) { $tmp = Pi::api('form', 'user')->parseCompoundFieldName($key); if ($tmp) { $result[$tmp[0]][0][$tmp[1]] = $value; } else { $result[$key] = $value; } } return $result; }
public function __construct($name = null, $option = array()) { $this->option = $option; $this->module = Pi::service('module')->current(); parent::__construct($name); }
/** * Get sort form instance * * @param int $from * @param array $sibling * * @return Form */ protected function getSortForm($from, array $sibling) { $name = $sibling[$from]; unset($sibling[$from]); $form = new Form(); $elements = array(array('name' => 'from', 'options' => array('label' => __('From')), 'attributes' => array('class' => 'form-control', 'options' => array($from => $name)), 'type' => 'select'), array('name' => 'to', 'options' => array('label' => __('To')), 'attributes' => array('class' => 'form-control', 'options' => array(0 => __('First of')) + $sibling), 'type' => 'select'), array('name' => 'security', 'type' => 'csrf'), array('name' => 'submit', 'attributes' => array('value' => __('Submit')), 'type' => 'submit')); foreach ($elements as $element) { $form->add($element); } return $form; }
/** * Constructor * * @param null|string|int $name Optional name for the form * @param string $module Page module */ public function __construct($name = null, $module = null) { $this->module = $module; parent::__construct($name); }
/** * Constructor * * @param string|int $name Optional name for the element * @param string $type */ public function __construct($name = null, $type = null) { $this->type = $type; parent::__construct($name); }
/** * Constructor * * @param null|string|int $name Optional name for the element * @param string $markup Page type: text, html, markdown */ public function __construct($name = null, $markup = null) { $this->markup = $markup ?: $this->markup; parent::__construct($name); }
public function __construct($name = null, $option = array()) { parent::__construct($name); }
public function __construct($name, $options = array()) { $this->items = isset($options['elements']) ? $options['elements'] : array(); $this->custom = isset($options['custom']) ? $options['custom'] : array(); parent::__construct($name); }