Append slider display related fields

@param Form  $form    The form
@param Front $subject The StoreFront tab

@return FrontPlugin
13664
private function appendSliderDisplayRelatedFields($form, $subject)
    {
        $attribute          = $this->getAttribute();
        $isAttributeDecimal = $attribute->getBackendType() == 'decimal' || $attribute->getFrontendClass() == 'validate-number';

        if ($isAttributeDecimal && ($attribute->getFrontendInput() !== 'price')) {
            $displayFieldset = $this->createDisplayFieldset($form, $subject);
            $this->addDisplayFields($displayFieldset);
        }

        return $this;
    }
550329
protected function addColumnElementToForm(Form $form, Property $property) {
		$annotationType = $property->getAnnotation()->type;
		$label = $property->getName();
		switch ($annotationType) {
			case 'datetime':
				$element = new DateTime($property->getName());
				break;
			case 'date':
				$element = new Date($property->getName());
				break;
			case 'time':
				$element = new Time($property->getName());
				break;
			case 'text':
				$element = new Textarea($property->getName());
				break;
			case 'boolean':
				$element = new Checkbox($property->getName());
				break;
			default:
				if (in_array($property->getName(), $this->emailProperties)) {
					$element = new Email($property->getName());
				} elseif (in_array($property->getName(), $this->passwordProperties)) {
					$element = new Password($property->getName());
					$element->setLabel($property->getName());
					$form->add($element);
				
					$element = new Password($property->getName() . '2');   //repeat password field
					$label = $property->getName() . ' (repeat)';
				} else {
					$element = new Text($property->getName());
				}
				break;
		}
		
		$element->setLabel($label);
		$form->add($element);
	}
572586
public function renderForm(Form $form)
	{
		foreach ($form as $element)
		{
			$this->render($element);
		}

		$tableRender = new SimpleTable();
		$tableContent = $tableRender->renderTable($this->table);

		return Html::tag('form', $form->getAttributes(), $tableContent);
	}
506678
protected function addChildrenField($form)
    {
        $form->add(
            'children',
            CollectionType::class,
            [
                'entry_type'   => self::class,
                'required'     => false,
                'allow_add'    => true,
                'allow_delete' => true,
                'prototype'    => true,
                'by_reference' => false,
            ]
        );
    }
625554
public function formExtendFields($form)
    {
        if ($form->getContext() == 'myaccount') {
            return;
        }

        if (!$this->user->isSuperUser()) {
            $form->removeField('is_superuser');
        }

        /*
         * Add permissions tab
         */
        $form->addTabFields($this->generatePermissionsField());

        /*
         * Mark default groups
         */
        if (!$form->model->exists) {
            $defaultGroupIds = UserGroup::where('is_new_user_default', true)->lists('id');

            $groupField = $form->getField('groups');
            $groupField->value = $defaultGroupIds;
        }
    }
1164902
protected function setButtonsContainer(&$form)
    {
        $form->fieldset('', function (Fieldset $fieldset) {
            $fieldset->control('button', 'cancel-button')
                    ->attributes(['type' => 'submit', 'class' => 'btn btn--md btn--default mdl-button mdl-js-button mdl-js-ripple-effect'])
                    ->value(trans('antares/foundation::label.cancel'));

            $fieldset->control('button', 'save-button')
                    ->attributes(['type' => 'submit'])
                    ->value(trans('antares/foundation::label.save'));
        });
    }
225219
public function createMessageAction(Subject $subject)
    {
        $form = $this->container->get('form.factory')->create(new MessageType, new Message());
        $form->handleRequest($this->get('request'));


        if ($form->isValid()) {
            $message = $form->getData();
            $this->manager->createMessage($message, $subject);
        }

        return new RedirectResponse(
            $this->generateUrl('claro_forum_messages', array('subject' => $subject->getId()))
        );
    }
1165607
public function doAddPackage($data, Form $form) {
        $record=new SnippetPackage();
        if($record->canEdit()) {
            $form->saveInto($record);
            $record->write();
            
            
            Requirements::customScript("window.parent.jQuery('#".$this->getName()."').entwine('ss').handleSuccessResult(".$record->ID.");");
            return $this->renderWith('CMSDialog', array('Form'=>''));
        }
        
        return Controller::curr()->redirectBack();
    }
111531
public function form(Form $form)
    {
        if ($this->mode == self::MODE_INLINE || $this->mode == self::MODE_INLINE_NO_LABELS) {
            $form->addClass('form-inline');
        } elseif ($this->mode == self::MODE_HORIZONTAL) {
            $form->addClass('form-horizontal');
        }

        return parent::form($form);
    }
1263301
public function doPrevious($data, $form)
    {
        $this->getToplevelController()->getResponse()->addHeader('X-Pjax', 'Content');
        $link = $this->getEditLink($this->getPreviousRecordID());
        return $this->redirect($link);
    }
1035385
public function afterGetVariables(\Magento\Email\Block\Adminhtml\Template\Edit\Form $subject, $result)
    {
        $additionalConfigValues = $this->variables->getAdditionalConfigVariables();
        $optionArray = [];
        foreach ($additionalConfigValues as $variable) {
            $optionArray[] = [
                'value' => '{{config path="' . $variable['value'] . '"}}',
                'label' => $variable['label'],
            ];
        }
        if ($optionArray) {
            $result[] = [
                'label' => __('Imprint'),
                'value' => $optionArray,
            ];
        }
        return $result;
    }
789146
protected function addTargetField($form, array $options)
    {
        $rootFormName = $form->getRoot()->getName();

        if ($options['withTarget']) {
            $form->add('target', ChoiceType::class, [
                'label'    => 'form.link_type.target.label',
                'required' => true,
                'choices'  => [
                    'form.link_type.choice.target.parent'     => Link::TARGET_PARENT,
                    'form.link_type.choice.target.blank'      => Link::TARGET_BLANK,
                    'form.link_type.choice.target.ajax-modal' => Link::TARGET_MODAL,
                ],
                'choices_as_values' => true,
                'attr'              => [
                    'data-refreshOnChange' => 'true',
                    'data-target'          => $options['refresh-target'] ?: 'form[name="'.$rootFormName.'"]',
                ],
                'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group viewReference-type page-type url-type route-type attachedWidget-type'],
            ]);
        }
    }
720471
function startForm(&$form){
        global $PAGE;
        $this->_reqHTML = $form->getReqHTML();
        $this->_elementTemplates = str_replace('{req}', $this->_reqHTML, $this->_elementTemplates);
        $this->_advancedHTML = $form->getAdvancedHTML();
        $this->_collapseButtons = '';
        $formid = $form->getAttribute('id');
        parent::startForm($form);
        if ($form->isFrozen()){
            $this->_formTemplate = "\n<div id=\"$formid\" class=\"mform frozen\">\n{collapsebtns}\n{content}\n</div>";
        } else {
            $this->_formTemplate = "\n<form{attributes}>\n\t<div style=\"display: none;\">{hidden}</div>\n{collapsebtns}\n{content}\n</form>";
            $this->_hiddenHtml .= $form->_pageparams;
        }

        if ($form->is_form_change_checker_enabled()) {
            $PAGE->requires->yui_module('moodle-core-formchangechecker',
                    'M.core_formchangechecker.init',
                    array(array(
                        'formid' => $formid
                    ))
            );
            $PAGE->requires->string_for_js('changesmadereallygoaway', 'moodle');
        }
        if (!empty($this->_collapsibleElements)) {
            if (count($this->_collapsibleElements) > 1) {
                $this->_collapseButtons = $this->_collapseButtonsTemplate;
                $this->_collapseButtons = str_replace('{strexpandall}', get_string('expandall'), $this->_collapseButtons);
                $PAGE->requires->strings_for_js(array('collapseall', 'expandall'), 'moodle');
            }
            $PAGE->requires->yui_module('moodle-form-shortforms', 'M.form.shortforms', array(array('formid' => $formid)));
        }
        if (!empty($this->_advancedElements)){
            $PAGE->requires->js_call_amd('core_form/showadvanced', 'init', [$formid]);
        }
    }
1317694
protected function persistData(Form $form)
    {
        parent::persistData($form);

        $positionData = $form->get('tabs')->get('position_tab')->get('position')->getNormData();

        if ($positionData) {
            $positionData = json_decode($positionData);
            /** @var MenuItem $data */
            $data = $form->getData();

            $entityManager = $this->getDoctrine()->getEntityManager();
            /** @var NestedTreeRepository $menuItemRepo */
            $menuItemRepo = $this->getDoctrine()->getRepository($this->getEntityName());

            $positionData->parent = intval($positionData->parent) ? ($positionData->parent) : 0;

            $data->setParent(null);
            if (intval($positionData->parent) > 0) {
                $data->setParent($entityManager->getReference($this->getEntityName(), $positionData->parent));
            }

            $menuItemRepo->persistAsFirstChild($data);
            if ($positionData->position) {
                $menuItemRepo->moveDown($data, $positionData->position);
            }

            $entityManager->flush();
        }
    }
98455
protected function setForm(Doozr_Form_Service_Component_Interface_Form $form = null)
    {
        // Check for scope inject requirement
        if (null !== $form && null === $form->getName()) {
            $form->setName($this->getScope());
        }

        $this->form = $form;
    }
1103893
private function addFormElements(array &$form, array $values) {
    $form['filter_controls'] = [
      '#markup' => '
          <div class="container controls-wrapper hidden-sm hidden-md hidden-lg">
          <a href="#" class="btn btn-link transparent-blue add-filters">' . $this->t('Add filters') . '</a>
          <a href="#" class="btn btn-link transparent-blue close-filters hidden">' . $this->t('Close filters') . '</a>
          </div>',
    ];

    $form['selects'] = [
      '#type' => 'container',
      '#attributes' => [
        'class' => [
          'container',
          'selects-container',
          'hidden-xs',
        ],
      ],
    ];

    $form['selects']['location'] = [
      '#type' => 'select',
      '#title' => $this->t('Location'),
      '#options' => $this->getLocationOptions(),
      '#prefix' => '<hr/>',
      '#default_value' => isset($values['location']) ? $values['location'] : 'All',
      '#ajax' => [
        'callback' => [$this, 'rebuildAjaxCallback'],
        'wrapper' => 'schedules-search-form-wrapper',
        'event' => 'change',
        'method' => 'replace',
        'effect' => 'fade',
        'progress' => [
          'type' => 'throbber',
        ],
      ],
    ];

    $form['selects']['program'] = [
      '#type' => 'select',
      '#title' => $this->t('Program'),
      '#options' => $this->getProgramOptions(),
      '#default_value' => isset($values['program']) ? $values['program'] : 'all',
      '#ajax' => [
        'callback' => [$this, 'rebuildAjaxCallback'],
        'wrapper' => 'schedules-search-form-wrapper',
        'event' => 'change',
        'method' => 'replace',
        'effect' => 'fade',
        'progress' => [
          'type' => 'throbber',
        ],
      ],
    ];

    $form['selects']['category'] = [
      '#type' => 'select',
      '#title' => $this->t('Sub-Program'),
      '#options' => $this->getCategoryOptions(),
      '#default_value' => isset($values['category']) ? $values['category'] : 'all',
      '#ajax' => [
        'callback' => [$this, 'rebuildAjaxCallback'],
        'wrapper' => 'schedules-search-form-wrapper',
        'event' => 'change',
        'method' => 'replace',
        'effect' => 'fade',
        'progress' => [
          'type' => 'throbber',
        ],
      ],
    ];

    $form['selects']['class'] = [
      '#type' => 'select',
      '#title' => $this->t('Class'),
      '#options' => $this->getClassOptions(),
      '#default_value' => isset($values['class']) ? $values['class'] : 'all',
      '#ajax' => [
        'callback' => [$this, 'rebuildAjaxCallback'],
        'wrapper' => 'schedules-search-form-wrapper',
        'event' => 'change',
        'method' => 'replace',
        'effect' => 'fade',
        'progress' => [
          'type' => 'throbber',
        ],
      ],
    ];

    $form['selects']['date'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Date'),
      '#default_value' => isset($values['date']) ? $values['date'] : '',
      '#attributes' => [
        'class' => ['openy-schedule-datepicker'],
      ],
      '#ajax' => [
        'callback' => [$this, 'rebuildAjaxCallback'],
        'wrapper' => 'schedules-search-form-wrapper',
        'event' => 'change',
        'method' => 'replace',
        'effect' => 'fade',
        'progress' => [
          'type' => 'throbber',
        ],
        // Do not focus current input element after ajax finish.
        'disable-refocus' => TRUE,
      ],
    ];

    $form['selects']['time'] = [
      '#type' => 'select',
      '#title' => $this->t('Start Time:'),
      '#options' => $this->getTimeOptions(),
      '#default_value' => isset($values['time']) ? $values['time'] : 'all',
      '#ajax' => [
        'callback' => [$this, 'rebuildAjaxCallback'],
        'wrapper' => 'schedules-search-form-wrapper',
        'event' => 'change',
        'method' => 'replace',
        'effect' => 'fade',
        'progress' => [
          'type' => 'throbber',
        ],
      ],
    ];

    $form['selects']['display'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Weekly View'),
      '#default_value' => isset($values['display']) ? $values['display'] : 0,
      '#title_display' => 'before',
      '#ajax' => [
        'callback' => [$this, 'rebuildAjaxCallback'],
        'wrapper' => 'schedules-search-form-wrapper',
        'event' => 'change',
        'method' => 'replace',
        'effect' => 'fade',
        'progress' => [
          'type' => 'throbber',
        ],
      ],
    ];

    // If on Weekly View, default and disable time field.
    if (isset($values['display']) && $values['display']) {
      $form['selects']['time']['#disabled'] = TRUE;
      $form['selects']['time']['#default_value'] = 'all';
    }

    $form['selects']['button'] = [
      '#type' => 'button',
      '#prefix' => '<div class="actions-wrapper hidden-xs hidden-sm hidden-md hidden-lg">',
      '#suffix' => '</div>',
      '#attributes' => [
        'class' => [
          'btn',
          'blue',
        ]
      ],
      '#value' => $this->t('Apply filters'),
      '#ajax' => [
        'callback' => [$this, 'rebuildAjaxCallback'],
        'method' => 'replace',
        'event' => 'click',
      ],
    ];

    $form['filters'] = [
      '#type' => 'container',
      '#prefix' => '<div class="filters-main-wrapper hidden-sm"><div class="container filters-container">',
      '#suffix' => '</div></div>',
      '#attributes' => [
        'class' => [
          'container',
          'filters-container',
        ],
      ],
      '#markup' => '',
      '#weight' => 99,
      'filters' => self::buildFilters($values),
    ];

    $form['alerts'] = [
      views_embed_view('header_alerts', 'specific_alerts_block', $values['location']),
    ];
    $form['alerts']['#prefix'] = '<div class="alerts-wrapper cleafix"><div class="container"><div class="row"><div class="col-xs-12">';
    $form['alerts']['#suffix'] = '</div></div></div></div>';
    $form['alerts']['#weight'] = 100;
  }
948553
public function buildForm(array $form, FormStateInterface $form_state) {

    // Redirect the user to the homepage if they are already logged in.
    if ($this->commerceUserManager->isAuthenticated()) {
      return $this->redirect('<front>');
    }

    $request = $this->requestStack->getCurrentRequest();
    $password_token = $request->query->get('token');
    $email = $request->query->get('email');

    $form['email'] = [
      '#type' => 'email',
      '#title' => $this->t('Email Address'),
      '#default_value' => $email,
      '#disabled' => isset($email) ? TRUE : FALSE,
      '#required' => TRUE,
    ];

    $form['new_password'] = [
      '#type' => 'password_confirm',
      '#required' => TRUE,
    ];

    $form['password_token'] = [
      '#type' => 'hidden',
      '#value' => $password_token,
    ];

    $form['actions'] = [
      '#type' => 'actions',
    ];

    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Update password'),
    ];

    return $form;
  }