/** * Add a form field * @param $label Field Label * @param $object Field Object * @param $size Field Size */ public function addQuickField($label, IWidget $object, $size = 200) { $object->setSize($size, $size); parent::addField($object); // adiciona uma linha para o campo código $row = $this->table->addRow(); $row->addCell(new TLabel($label)); $row->addCell($object); }
/** * Add a form field * @param $label Field Label * @param $object Field Object * @param $size Field Size * @param $validator Field Validator */ public function addQuickField($label, IWidget $object, $size = 200, TFieldValidator $validator = NULL) { $object->setSize($size, $size); parent::addField($object); // add the field to the container $row = $this->table->addRow(); if ($validator instanceof TRequiredValidator) { $label_field = new TLabel($label . '(*)'); $label_field->setFontColor('#FF0000'); } else { $label_field = new TLabel($label); } $row->addCell($label_field); $row->addCell($object); if ($validator) { $object->addValidation($label, $validator); } }
/** * Get widget instance */ public function getWidget() { if ($this->widget === NULL) { if (!isset($this->extension)) { if (empty($this->m_data['fk_widget_id'])) { $this->fetch(); } $this->extension = Extension_Extension::GetById($this->m_data['fk_widget_id']); } $this->widget = $this->extension->getInstance(); if ($this->widget === NULL) { return $this->widget; } $this->widget->setManager($this); if (!empty($this->m_data['settings'])) { $settings = json_decode($this->m_data['settings']); $this->widget->setSettings((array) $settings); } } return $this->widget; }
/** * Add a Form Field * @param $field Object */ public function addField(IWidget $field) { if ($field instanceof TField) { $name = $field->getName(); if (isset($this->fields[$name])) { throw new Exception(TAdiantiCoreTranslator::translate('You have already added a field called "^1" inside the form', $name)); } if ($name) { $this->fields[$name] = $field; $field->setFormName($this->name); if ($field instanceof TButton) { $field->addFunction($this->js_function); } } } if ($field instanceof TMultiField) { $this->js_function .= "mtf{$name}.parseTableToJSON();"; if ($this->fields) { // if the button was added before multifield foreach ($this->fields as $field) { if ($field instanceof TButton) { $field->addFunction($this->js_function); } } } } }
/** * Returns a widget type’s SVG icon. * * @param IWidget $widgetType * * @return string */ private function _getWidgetIconSvg(IWidget $widgetType) { $iconPath = $widgetType->getIconPath(); if ($iconPath && IOHelper::fileExists($iconPath) && FileHelper::getMimeType($iconPath) == 'image/svg+xml') { return IOHelper::getFileContents($iconPath); } return craft()->templates->render('_includes/defaulticon.svg', array('label' => $widgetType->getName())); }
/** * Add a Form Field * @param $field Object */ public function addField(IWidget $field) { if ($field instanceof GtkWidget) { $name = $field->getName(); if (isset($this->fields[$name])) { throw new Exception(TAdiantiCoreTranslator::translate('You have already added a field called "^1" inside the form', $name)); } $this->fields[$name] = $field; $field->setFormName($this->fname); } }
/** * Class constructor * @param string $label Text that will be displayed * @param string $parseName Name of the placeholder, that will be parsed with the value * @param string $value Standard value of the input * @param string $validation Validate the input filed with this functions (MANDATORY) * @param string $style Style of the input */ function PasswordInput($label, $parseName, $value = "", $style = "") { global $HTTP_POST_VARS; IWidget::IWidget($label, $parseName, $value, "", $style); $this->value1 = $value; if (isset($HTTP_POST_VARS[$this->parseName . '1'])) { $this->value = $HTTP_POST_VARS[$this->parseName . '1']; } if (isset($HTTP_POST_VARS[$this->parseName])) { $this->value1 = $HTTP_POST_VARS[$this->parseName]; } }
/** * * @param IWidget $widget */ public function addWidget(IWidget $widget) { $this->widgets[$widget->getReflection()->getShortName()] = $widget; }