本文整理汇总了PHP中Drupal\Core\Form\FormStateInterface::setBuildInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP FormStateInterface::setBuildInfo方法的具体用法?PHP FormStateInterface::setBuildInfo怎么用?PHP FormStateInterface::setBuildInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Form\FormStateInterface
的用法示例。
在下文中一共展示了FormStateInterface::setBuildInfo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadCachedFormState
/**
* Loads the cached form state.
*
* @param string $form_build_id
* The unique form build ID.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
protected function loadCachedFormState($form_build_id, FormStateInterface $form_state)
{
if ($stored_form_state = $this->keyValueExpirableFactory->get('form_state')->get($form_build_id)) {
// Re-populate $form_state for subsequent rebuilds.
$form_state->setFormState($stored_form_state);
// If the original form is contained in include files, load the files.
// @see \Drupal\Core\Form\FormStateInterface::loadInclude()
$build_info = $form_state->getBuildInfo();
$build_info += ['files' => []];
foreach ($build_info['files'] as $file) {
if (is_array($file)) {
$file += array('type' => 'inc', 'name' => $file['module']);
$this->moduleHandler->loadInclude($file['module'], $file['type'], $file['name']);
} elseif (file_exists($file)) {
require_once $this->root . '/' . $file;
}
}
// Retrieve the list of previously known safe strings and store it for
// this request.
// @todo Ensure we are not storing an excessively large string list
// in: https://www.drupal.org/node/2295823
$build_info += ['safe_strings' => []];
SafeMarkup::setMultiple($build_info['safe_strings']);
unset($build_info['safe_strings']);
$form_state->setBuildInfo($build_info);
}
}
示例2: setBuildInfo
/**
* {@inheritdoc}
*/
public function setBuildInfo(array $build_info)
{
$this->mainFormState->setBuildInfo($build_info);
return $this;
}
示例3: submitForm
public function submitForm(array &$form, FormStateInterface $form_state) {
$build_info = $form_state->getBuildInfo();
$build_info['args'][0]['parameters']['langcode'] = $form_state->getValue('langcode');
$build_info['args'][0]['parameters']['langcodes'] = $form_state->getValue('langcodes');
$form_state->setBuildInfo($build_info);
}
示例4: submitForm
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->_move_all_config_files_directory('general');
$this->_move_all_config_files_directory('seven');
$this->_move_all_config_files_directory('bfc_admin_theme');
$this->_move_all_config_files_directory('bootstrap');
$this->_move_all_config_files_directory('text_formats_editors');
$this->_move_all_config_files_directory('user');
$this->_move_all_config_files_directory('linkit');
if(!empty($_GET['langcodes'])){
# Enabled multilanguage modules
$this->_move_all_config_files_directory('multilanguage');
}
if ($form_state->getValue('editor') == 1) {
$this->_move_config_file('user.role.editor.yml', 'roles');
}
if ($form_state->getValue('administrator') == 1) {
$this->_move_config_file('user.role.administrator.yml', 'roles');
}
if ($form_state->getValue('article') == 1) {
$this->_move_all_config_files_directory('article');
}
if ($form_state->getValue('page') == 1) {
$this->_move_all_config_files_directory('page');
}
$build_info = $form_state->getBuildInfo();
$build_info['args'][0]['parameters']['configuration'] = TRUE;
$form_state->setBuildInfo($build_info);
}
示例5: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$installModules = [];
foreach ($form_state->getValues() as $key => $value) {
if (strpos($key, 'install_modules') !== FALSE && $value) {
preg_match('/install_modules_(?P<name>\\w+)/', $key, $values);
$installModules[] = $values['name'];
}
}
$buildInfo = $form_state->getBuildInfo();
$install_state = $buildInfo['args'];
$install_state[0]['thunder_additional_modules'] = $installModules;
$install_state[0]['form_state_values'] = $form_state->getValues();
$buildInfo['args'] = $install_state;
$form_state->setBuildInfo($buildInfo);
}
示例6: testSetBuildInfo
/**
* @covers ::setBuildInfo
*/
public function testSetBuildInfo()
{
$build_info = ['FOO' => 'BAR'];
$this->decoratedFormState->setBuildInfo($build_info)->shouldBeCalled();
$this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setBuildInfo($build_info));
}