Zmena hesla
@param Form $form
@param ArrayHash $values
518862
public function passwordFormSucceeded(Form $form, ArrayHash $values): void
	{
		try {
			$this->profile->setPassword($values->password, $values->oldPassword);
			$this->orm->persistAndFlush($this->profile);
			$this->flashNotifier->success('cms.user.passwordChanged');
		} catch (AuthenticationException $e) {
			$form->addError('cms.user.incorrectPassword');
		}
		if ($this->isAjax()) {
			$this->redrawControl('passwordForm');
		}
	}
519410
public function updateEditForm($form){
		if($this->modelIsMultiSitesAware()) {
			$managedSites = Multisites::inst()->sitesManagedByMember();
			$source = Site::get()->filter('ID', Multisites::inst()->sitesManagedByMember())->map('ID', 'Title')->toArray();
			$plural = singleton($this->owner->modelClass)->plural_name();
			if(!count($source)){
				$form->setFields(FieldList::create(
					LiteralField::create('NotAManager', "You do not have permission to manage $plural on any Sites")
				));
			}
		}
	}
980588
public function submitForm(array $values)
    {
        $this->value = isset($values[$this->name]) ? $values[$this->name] : null;
    }
1189091
protected function prepareFilterValues(FormInterface $form)
    {
        $config = $form->getConfig();
        $values = $this->dataExtractor->extractData($form, $config->getOption('data_extraction_method', 'default'));

        if ($config->hasAttribute('filter_options')) {
            $values = array_merge($values, $config->getAttribute('filter_options'));
        }

        return $values;
    }
940732
public function update($form)
    {
        $models = $this->getFields();
        foreach ($models as $model) {
            $model->save();
        }
    }
1020797
public function notify(Form $form = null, array $values = null)
    {
        //if define form in parameters
        if ($form) {
            $this->form = $form;
        }

        //if define values in parameters
        if ($values) {
            $this->setValues($values);
        }

        // iterate events
        foreach ($this->events as $eventIndex => $event) {
            // save index event
            $this->eventIndex = $eventIndex;

            // check instance of event
            if ($event instanceof IEvent) {
                $event->update($this, $this->values);
            } else {
                throw new EventException(get_class($event) . ' is not implements of ' . IEvent::class);
            }
        }
    }
887116
public function tabBuilder(\samsoncms\app\material\form\Form & $form)
    {
        // If we have related structures
        if (count($form->navigationIDs)) {
            // Get all gallery additional field for material form structures
            $galleryFields = $this->query->entity(\samsoncms\api\Field::class)
                ->where('Type', 9)
                ->join('structurefield')
                ->where('structurefield_StructureID', $form->navigationIDs)
                ->exec();

            // Create tab for each additional gallery field
            foreach ($galleryFields as $field) {
                $form->tabs[] = new Gallery($this, $this->query, $form->entity, $field);
            }
        }
    }
216185
public function form($form = null)
    {
        if (func_num_args() === 1) {
            $form = $form ?: [];
            $this->_form = $form;
            $this->set($form);
            return $this;
        }
        return $this->_form;
    }
1172401
private function renderForm($form, $data = [])
    {
        // Check for tag name
        if ($form->tagName != 'form') {
            return $this;
        }

        // Set form values
        FormHelper::setValues($this->getHTMLHandler(), $form, $data['values']);

        return $this;
    }
1068036
public function addFormSucceeded(Form $form, ArrayHash $values): void
	{
		if ($values->generatePassword) {
			$password = Random::generate($this->minPasswordLength, $this->passwordChars);
		} else {
			$password = $values->password;
		}

		$user = new User;
		$this->orm->users->attach($user);
		try {
			$user->setUsername($values->username);
		} catch (UniqueConstraintViolationException $ex) {
			$form->addError('cms.user.duplicityUsername');
			return;
		} catch (InvalidArgumentException $ex) {
			$form->addError('cms.user.invalidUsername');
			return;
		}

		try {
			$user->setEmail($values->email);
		} catch (UniqueConstraintViolationException $ex) {
			$form->addError('cms.user.duplicityEmail');
			return;
		} catch (InvalidArgumentException $ex) {
			$form->addError('cms.user.invalidUsername');
			return;
		}

		try {
			$user->setPhone($values->phone ?: null);
		} catch (InvalidArgumentException $ex) {
			$form->addError('cms.user.invalidPhone');
			return;
		}

		$user->firstName = $values->firstName;
		$user->surname = $values->surname;

		$language = $this->localeService->getById($values->language);
		$user->language = $language === null ? null : $language->name;

		$user->roles->set($values->roles);
		$user->setPassword($password);

		$this->orm->persistAndFlush($user);

		if ($this->configurator->sendNewUserPassword) {
			$this->mailer->sendNewUser($user->email, $user->username, $password);
		}

		$this->flashNotifier->success('cms.user.dataSaved');
		$this->restoreBacklink();
	}
1076039
protected function process_form_data(array $form) {

        $count = count($form); // number of form field values

        if ($count % 2) {
            // we must get five fields per expression
            return false;
        }

        $regexes = array();
        for ($i = 0; $i < $count / 2; $i++) {
            $expressionname  = "expression".$i;
            $valuename       = "value".$i;

            $expression = trim($form['expression'.$i]);
            $value      = trim($form['value'.$i]);

            if (empty($expression)){
                continue;
            }

            $regexes[$value] = $expression;
        }

        $regexes = json_encode($regexes);

        return $regexes;
    }
243646
public function alterFormValues(array $formValues)
    {
        foreach ($this->getMeta() as $key => $fieldMeta) {
            /** @var \stdClass $fieldMeta */
            if ($fieldMeta->type === 'checkbox') {
                if (isset($formValues[$key])) {
                    $prestaShopName = $fieldMeta->collection . '_' . $key;
                    $formValues[$prestaShopName] = $formValues[$key];
                }
            }
        }
        return $formValues;
    }
880229
protected function makeRequestUsingForm(Form $form, array $uploads = [])
    {
        $files = $this->convertUploadsForTesting($form, $uploads);

        return $this->makeRequest(
            $form->getMethod(), $form->getUri(), $this->extractParametersFromForm($form), [], $files
        );
    }
696368
public function submitForm(array &$form, FormStateInterface $form_state)
    {
        $site    = &$form_state->getTemporaryValue('site');
        $values  = &$form_state->getValues();

        /** @var $site Site */
        $site->title          = $values['title'];
        $site->title_admin    = $values['title_admin'];
        $site->http_redirects = $values['http_redirects'];
        $site->replacement_of = $values['replacement_of'];
        $site->http_host      = $values['http_host'];
        $site->allowed_protocols = $values['allowed_protocols'];
        $site->theme          = $values['theme'];
        $attributes = $form_state->getValue('attributes', []);
        foreach ($attributes as $name => $attribute) {
            $site->setAttribute($name, $attribute);
        }

        $this->manager->getStorage()->save($site);
        drupal_set_message($this->t("Site modifications have been saved"));

        $this->dispatcher->dispatch('site:update', new SiteEvent($site, $this->currentUser()->uid));

        $form_state->setRedirect('admin/dashboard/site/' . $site->id);
    }
820163
private function getValue($form, $name)
    {
        if (is_array($form)) {
            return isset($form[$name]) ? $form[$name] : null;
        } elseif (is_object($form)) {
            $method = 'get' . $name;
            if (method_exists($form, $method)) {
                return $form->$method();
            } else {
                return isset($form->$name) ? $form->$name : null;
            }
        }
    }
1281846
public function passwordFormSucceeded(Form $form, ArrayHash $values): void
	{
		if ($values->generatePassword) {
			$password = Random::generate($this->minPasswordLength, $this->passwordChars);
		} else {
			$password = $values->password;
		}

		$this->currentUser->setPassword($password);

		$this->orm->persistAndFlush($this->currentUser);

		if ($this->configurator->sendChangePassword) {
			$this->mailer->sendNewPassword($this->currentUser->email, $this->currentUser->username, $password);
		}

		$this->flashNotifier->success('cms.user.passwordChanged');
		$this->restoreBacklink();
	}
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;
		}
	}