Exemple #1
0
 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     $html = parent::getInput();
     $default = SibdietHelper::getDefault((int) $this->value);
     $class = $this->element['class'] ? ' class="control-label ' . (string) $this->element['class'] . '"' : 'control-label';
     $html .= '<div' . $class . '>' . $default . '</div>';
     return $html;
 }
 protected function getInput()
 {
     $doc = JFactory::getDocument();
     $doc->addScript(JURI::root(true) . '/administrator/components/com_visforms/js/itemlistcreator.js');
     $texts = "{texts : {txtMoveUp: '" . addslashes(JText::_('COM_VISFORMS_ITEMLISTCREATOR_MOVE_UP')) . "'," . "txtMoveDown: '" . addslashes(JText::_('COM_VISFORMS_ITEMLISTCREATOR_MOVE_DOWN')) . "'," . "txtChange: '" . addslashes(JText::_('COM_VISFORMS_ITEMLISTCREATOR_CHANGE')) . "'," . "txtDelete: '" . addslashes(JText::_('COM_VISFORMS_DEL')) . "'," . "txtClose: '" . addslashes(JText::_('COM_VISFORMS_ITEMLISTCREATOR_CLOSE')) . "'," . "txtAddItem: '" . addslashes(JText::_('COM_VISFORMS_ADD')) . "'," . "txtCreateItem: '" . addslashes(JText::_('COM_VISFORMS_ITEMLISTCREATOR_CREATE_NEW_ITEM')) . "'," . "txtReset: '" . addslashes(JText::_('COM_VISFORMS_ITEMLISTCREATOR_RESET')) . "'," . "txtSave: '" . addslashes(JText::_('COM_VISFORMS_ITEMLISTCREATOR_SAVE')) . "'," . "txtJYes: '" . addslashes(JText::_('JYES')) . "'," . "txtJNo: '" . addslashes(JText::_('JNO')) . "'," . "txtAlertRequired: '" . addslashes(JText::_('COM_VISFORMS_ITEMLISTCREATOR_REQUIRED_LABEL_VALUE')) . "'," . "txtValue: '" . addslashes(JText::_('COM_VISFORMS_VALUE')) . "'," . "txtLabel: '" . addslashes(JText::_('COM_VISFORMS_LABEL')) . "'," . "txtDefault: '" . addslashes(JText::_('COM_VISFORMS_DEFAULT')) . "'" . "}," . " params: {fieldName : '" . $this->fieldname . "'}" . "}";
     $script = 'var visformsItemlistCreator' . $this->fieldname . ' = jQuery(document).ready(function() {jQuery("#item-form").visformsItemlistCreator(' . $texts . ')});';
     $doc->addScriptDeclaration($script);
     $hiddenInput = parent::getInput();
     $html = $hiddenInput;
     return $html;
 }
Exemple #3
0
 /**
  * Method to get certain otherwise inaccessible properties from the form field object.
  *
  * @param   string  $name  The property name for which to the the value.
  *
  * @return  mixed  The property value or null.
  *
  * @since   2.0
  */
 public function __get($name)
 {
     switch ($name) {
         case 'static':
             if (empty($this->static)) {
                 $this->static = $this->getStatic();
             }
             return $this->static;
             break;
         case 'repeatable':
             if (empty($this->repeatable)) {
                 $this->repeatable = $this->getRepeatable();
             }
             return $this->repeatable;
             break;
         default:
             return parent::__get($name);
     }
 }
 /**
  * Method to get the field input markup for a generic list.
  * Use the multiple attribute to enable multiselect.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     return parent::getInput() . "\n" . $this->getMegaMenuMarkup();
 }
Exemple #5
0
 /**
  * Tests hidden field type property setup by JFormField::setup method
  *
  * @covers JFormField::setup
  * @covers JFormField::__get
  *
  * @return void
  */
 public function testSetupHiddenFieldType()
 {
     $field = new JFormFieldHidden();
     $element = simplexml_load_string('<field name="myName" type="hidden" />');
     $this->assertThat($field->setup($element, 42), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true if successful.');
     $this->assertThat($field->hidden, $this->isTrue(), 'Line:' . __LINE__ . ' The hidden property should be set from the field type.');
 }