Nastaví disabled na prvky formuláře
@param Form $form
@param bool $disabled
424004
protected function setDisabledForm(Form $form, bool $disabled = TRUE) : void
    {
        foreach ($form->getComponents() as $component)
        {
            $component->setDisabled($disabled);
        }
    }
85162
public function process(base_moodleform $form = null) {
        $form = $this->initialise_stage_form();
        // Check it hasn't been cancelled.
        if ($form->is_cancelled()) {
            $this->ui->cancel_process();
        }

        $data = $form->get_data();
        if ($data && confirm_sesskey()) {
            return 0;
        } else {
            return false;
        }
    }
838148
public void setDisabled(boolean disabled) {
		this.disabled = disabled;
		if (disabled) {
			handlerManager.fireEvent(new ToolbarActionDisabledEvent());
		} else {
			handlerManager.fireEvent(new ToolbarActionEnabledEvent());
		}
	}
958727
protected function getElementId(Form $form)
    {
        /** @var Form $parent */
        $parent = $form->getParent();
        if (null !== $parent) {
            return $this->getElementId($parent) . '_' . $form->getName();
        } else {
            return $form->getName();
        }
    }
1363609
public function setDisabled(bool $disabled) : Element
    {
        if ($disabled) {
            $this->getTag()->setAttribute('disabled', 'disabled');
        } else {
            $this->getTag()->removeAttribute('disabled');
        }

        return $this;
    }
80725
public function updateItemEditForm(Form $form)
    {
        $record = $this->owner->getRecord();

        if ($this->shouldDisplayAction($record)) {
            $restoreToRoot = RestoreAction::shouldRestoreToRoot($record);

            $title = $restoreToRoot
                ? _t('SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT', 'Restore to draft at top level')
                : _t('SilverStripe\\Versioned\\RestoreAction.RESTORE', 'Restore to draft');
            $description = $restoreToRoot
                ? _t(
                    'SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT_DESC',
                    'Restore the archived version to draft as a top level item'
                )
                : _t(
                    'SilverStripe\\Versioned\\RestoreAction.RESTORE_DESC',
                    'Restore the archived version to draft'
                );

            $form->actions = FieldList::create(
                FormAction::create('doRestore', $title)
                    ->setDescription($description)
                    ->setAttribute('data-to-root', $restoreToRoot)
                    ->addExtraClass('btn-warning font-icon-back-in-time ArchiveAdmin__action--restore')
                    ->setUseButtonTag(true)
            );

            $form->unsetValidator();
        }
    }
722629
protected function prepare_fields( Form $form ) {
		foreach ( $form->all() as $field ) {
			/* @var $field \WPLibs\Form\Field */
			if ( ! $field->should_show() ) {
				return;
			}

			$_section = $field->get_option( 'section' );

			if ( ! $_section || ! isset( $this->sections[ $_section ] ) ) {
				continue;
			}

			$this->sections[ $_section ]->fields[] = $field;
		}
	}
1004960
public function render(Form $form, $mode = null) {
		$form->getElementPrototype()->addClass("form-horizontal");
		
		foreach($form->getControls() as $control) {
			if($control instanceof Checkbox || $control instanceof CheckboxList || $control instanceof RadioList) {
				$control->getSeparatorPrototype()->setName(null);
			}
			if($control instanceof Checkbox) {
				$control->getLabelPrototype()->addClass("checkbox-inline");
			}
			if($control instanceof CheckboxList) {
				$control->getItemLabelPrototype()->addClass("checkbox-inline");
			}
			if($control instanceof RadioList) {
				$control->getItemLabelPrototype()->addClass("radio-inline");
			}
			if($control instanceof TextBase || $control instanceof SelectBox || $control instanceof MultiSelectBox) {
				$control->getControlPrototype()->addClass("form-control");
			}
			if($control instanceof TextArea) {
				$control->getControlPrototype()->setAttribute("rows", 4);
			}
		}
		
		return parent::render($form, $mode);
	}
593552
function submitFoundationForm($data, $form) {
		if(isset($data['SecurityID'])) {
			unset($data['SecurityID']);
		}
		Session::set('FoundationForm' . $this->ID, $data);
		
		return $this->redirect($this->Link());
	}
802625
protected function _isDisabled($radio, $disabled)
    {
        if (!$disabled) {
            return false;
        }
        if ($disabled === true) {
            return true;
        }
        $isNumeric = is_numeric($radio['value']);

        return (!is_array($disabled) || in_array((string)$radio['value'], $disabled, !$isNumeric));
    }
1321695
public function onPreSetData(FormEvent $event)
    {
        if (!$event->getData() || !$event->getForm()->getConfig()->getOption('removable')) {
            return;
        }

        $event->getForm()->add('remove', 'checkbox', array(
            'label' => $this->options['remove_label']
        ));
    }
493619
public function & SetForm (\MvcCore\Ext\Forms\IForm & $form) {
		$this->form = & $form;
		return $this;
	}
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]);
        }
    }
1026931
public function setForm(\Mmi\Form\Form $form)
    {
        //parent
        parent::setForm($form);
        //obiekt niezdefiniowany
        if (!$this->getUploaderObject()) {
            //ustawianie obiektu
            $this->setUploaderObject($form->getFileObjectName());
        }
        //instancja front controllera
        $frontController = \Mmi\App\FrontController::getInstance();
        //uploaderId znajduje się w requescie
        if ($frontController->getRequest()->uploaderId) {
            $this->setOption(self::UPLOADER_ID_KEY, $frontController->getRequest()->uploaderId);
            return $this;
        }
        //przekierowanie na url zawierający nowowygenerowany uploaderId
        $frontController->getResponse()->redirectToUrl($frontController->getView()->url($frontController->getRequest()->toArray() + ['uploaderId' => mt_rand(1000000, 9999999)]));
        return $this;
    }
1250579
public function success(Form $form) : void
    {
        if ($this->presenter->isAjax())
        {
            $values = $form->getValues();

            $this->onPageManager->getConnection()->beginTransaction();

            try
            {
                $this->onPageManager->saveSocial($this->activePage, $values->title, $values->description);

                if ($values->image->isOk())
                {
                    $this->onPageManager->saveSocialImage($this->activePage, $values->image);
                }

                $this->onPageManager->getConnection()->commit();

                $this->presenter->notificationAjax(
                    'On-Page faktory',
                    'Informace pro sociální sítě byly úspěšně uloženy.',
                    'success',
                    FALSE
                );

                $this->onSave();
            }
            catch (DatabaseException|ProtectedFileException $exception)
            {
                $this->onPageManager->getConnection()->rollBack();

                $this->presenter->notificationAjax(
                    'Chyba',
                    $exception->getMessage(),
                    'error'
                );
            }
        }
    }
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();
        }
    }
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);
    }