@param IStagedForm $form

@return StagedForm
495753
public static function fromExisting(IStagedForm $form) : StagedForm
    {
        $self = new self($form->getFirstStage());

        $self->followingStages = $form->getFollowingStages();

        return $self;
    }
1107021
public function setForm(\Mmi\Form\Form $form)
    {
        $this->_form = $form;
        //ustawianie ID
        $this->setId($form->getBaseName() . '-' . $this->getName());
        return $this;
    }
139591
public function render(Form $form)
    {
        $this->htmlSpecialCharsFlag = ENT_NOQUOTES;
        if (defined('ENT_HTML5')) {
            $this->htmlSpecialCharsFlag |= $this->html5 ? ENT_HTML5 : ENT_HTML401;
        }
        $this->form = $form;
        $this->form->addValues();
        return $this->renderFields($this->form->getFields());
    }
590325
static function registerForm (Form $form)
    {
        if (!in_array($form, self::$forms))
            array_push(self::$forms, $form);
    }
360211
public function setForm($form)
    {
        // Associate Fields with Form:
        
        $this->honeypot->setForm($form);
        $this->timestamp->setForm($form);
        
        // Call Parent Method:
        
        return parent::setForm($form);
    }
354716
public function forInstance(StagedFormObject $formObject)
    {
        $self                  = new self($formObject, $this->defineStageCallbacks);
        $self->knownProperties = $this->knownProperties;

        return $self;
    }
1065649
final protected function defineForm(StagedFormObjectDefinition $form)
    {
        $form->stage(function (FormObjectDefinition $form) {
            $form->section('Object', [
                    ObjectForm::objectField($form->field($this->object), $this->dataSource)
            ]);
        });

        $this->defineFormStages($form);
    }
135762
public function render(Nette\Forms\Form $form, $mode = null)
    {
        $form->getElementPrototype()->setClass('form-inline');

        foreach ($form->getControls() as $control) {
            if ($control instanceof Controls\Button) {
                $usedPrimary = true;
            } elseif ($control instanceof Controls\TextBase ||
                $control instanceof Controls\SelectBox ||
                $control instanceof Controls\MultiSelectBox) {
                $control->getControlPrototype()->addClass('form-control');
            } elseif ($control instanceof Controls\Checkbox ||
                $control instanceof Controls\CheckboxList ||
                $control instanceof Controls\RadioList) {
                $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
            }
        }

        return parent::render($form, $mode);
    }
536057
public function withFormData(IForm $form)
    {
        call_user_func($this->callback, new FormDataWidget($this->name, $this->label, $this->authSystem, $this->requiredPermissions, $form));
    }
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;
        }
    }
1241065
public function merge(\sndsgd\Form ...$forms): Form
    {
        foreach ($forms as $form) {
            $fields = array_values($form->getFields());
            $this->addFields(...$fields);
        }

        return $this;
    }
233466
public function defineFormStage(StagedFormObject $instance) : \Dms\Core\Form\Object\FinalizedFormObjectDefinition
    {
        return call_user_func($this->defineFormStageCallback, $instance);
    }
1027213
private function renderForm(Form $form) : string
    {
        $html = '';

        foreach ($form->getComponents() as $component) {
            $html .= $this->renderErrors($component);

            if ($component instanceof Element) {
                $html .= $this->renderElement($component);
            } elseif ($component instanceof Group) {
                foreach ($component->getElements() as $element) {
                    $html .= $this->renderElement($element);
                }
            }
        }

        return $html;
    }
1371566
protected function defineForm(FormObjectDefinition $form)
    {
        $form->section('Account Details', [
            $form->bind($this->serviceAccountEmail)->to(
                Field::create('service_account_email', 'Service Account Email')
                    ->string()->email()->required()
            ),
            //
            $form->bind($this->privateKeyData)->to(
                Field::create('private_key_data', 'Private Key (*.p12)')
                    ->file()->required()
                    ->extension('p12')
                    ->map(function (IUploadedFile $file) {
                        return base64_encode(file_get_contents($file->getFullPath()));
                    }, function (string $data) {
                        return new InMemoryFile(base64_decode($data), 'key.p12');
                    }, Type::string())
            ),
            //
            $form->bind($this->viewId)->to(
                Field::create('view_id', 'View ID')
                    ->int()->required()
            ),
        ]);

        $form->section('Dashboard', [
            $form->bind($this->locationChartMode)->to(
                Field::create('location_chart_mode', 'Analytics Map Mode')
                    ->enum(GoogleChartMode::class, [
                        GoogleChartMode::CITY    => 'Cities',
                        GoogleChartMode::COUNTRY => 'Countries',
                    ])
            ),
            //
            $form->bind($this->mapCountry)->to(
                Field::create('map_country', 'Analytics Map Country')
                    ->enum(Country::class, Country::getNameMap())
            ),
        ]);

        $form->section('Embed', [
            //
            $form->bind($this->trackingCode)->to(
                Field::create('tracking_code', 'UA tracking code')
                    ->string()->required()
            ),
        ]);
    }
1148295
protected function generateSuccessRedirect(BaseForm $form = null)
    {
        if (null !== $url = $this->retrieveSuccessUrl($form)) {
            return $this->generateRedirect($url);
        }

        return null;
    }
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;
    }
1272439
public function process(base_moodleform $form = null) {
        $form = $this->initialise_stage_form();

        if ($form->is_cancelled()) {
            $this->ui->cancel_process();
        }

        $data = $form->get_data();
        if ($data && confirm_sesskey()) {
            $tasks = $this->ui->get_tasks();
            $changes = 0;
            foreach ($tasks as &$task) {
                // We are only interesting in the backup root task for this stage.
                if ($task instanceof restore_root_task || $task instanceof restore_course_task) {
                    // Get all settings into a var so we can iterate by reference.
                    $settings = $task->get_settings();
                    foreach ($settings as &$setting) {
                        $name = $setting->get_ui_name();
                        if (isset($data->$name) &&  $data->$name != $setting->get_value()) {
                            $setting->set_value($data->$name);
                            $changes++;
                        } else if (!isset($data->$name) && $setting->get_ui_type() == backup_setting::UI_HTML_CHECKBOX && $setting->get_value()) {
                            $setting->set_value(0);
                            $changes++;
                        }
                    }
                }
            }
            // Return the number of changes the user made.
            return $changes;
        } else {
            return false;
        }
    }