function install_state_defaults

Same name in other branches
  1. 7.x includes/install.core.inc \install_state_defaults()
  2. 9 core/includes/install.core.inc \install_state_defaults()
  3. 10 core/includes/install.core.inc \install_state_defaults()
  4. 11.x core/includes/install.core.inc \install_state_defaults()

Returns an array of default settings for the global installation state.

The installation state is initialized with these settings at the beginning of each page request. They may evolve during the page request, but they are initialized again once the next request begins.

Non-interactive Drupal installations can override some of these default settings by passing in an array to the installation script, most notably 'parameters' (which contains one-time parameters such as 'profile' and 'langcode' that are normally passed in via the URL) and 'forms' (which can be used to programmatically submit forms during the installation; the keys of each element indicate the name of the installation task that the form submission is for, and the values are used as the $form_state->getValues() array that is passed on to the form submission via \Drupal::formBuilder()->submitForm()).

See also

\Drupal\Core\Form\FormBuilderInterface::submitForm()

2 calls to install_state_defaults()
install_drupal in core/includes/install.core.inc
Installs Drupal either interactively or via an array of passed-in settings.
UserAccountFormFieldsTest::testInstallConfigureForm in core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php
Tests the root user account form section in the "Configure site" form.

File

core/includes/install.core.inc, line 192

Code

function install_state_defaults() {
    $defaults = [
        // The current task being processed.
'active_task' => NULL,
        // The last task that was completed during the previous installation
        // request.
'completed_task' => NULL,
        // Partial configuration cached during an installation from existing config.
'config' => NULL,
        // The path to the configuration to install when installing from config.
'config_install_path' => NULL,
        // TRUE when there are valid config directories.
'config_verified' => FALSE,
        // TRUE when there is a valid database connection.
'database_verified' => FALSE,
        // TRUE when a valid settings.php exists (containing both database
        // connection information and config directory names).
'settings_verified' => FALSE,
        // TRUE when the base system has been installed and is ready to operate.
'base_system_verified' => FALSE,
        // Whether a translation file for the selected language will be downloaded
        // from the translation server.
'download_translation' => FALSE,
        // An array of forms to be programmatically submitted during the
        // installation. The keys of each element indicate the name of the
        // installation task that the form submission is for, and the values are
        // used as the $form_state->getValues() array that is passed on to the form
        // submission via \Drupal::formBuilder()->submitForm().
'forms' => [],
        // This becomes TRUE only at the end of the installation process, after
        // all available tasks have been completed and Drupal is fully installed.
        // It is used by the installer to store correct information in the database
        // about the completed installation, as well as to inform theme functions
        // that all tasks are finished (so that the task list can be displayed
        // correctly).
'installation_finished' => FALSE,
        // Whether or not this installation is interactive. By default this will
        // be set to FALSE if settings are passed in to install_drupal().
'interactive' => TRUE,
        // An array of parameters for the installation, pre-populated by the URL
        // or by the settings passed in to install_drupal(). This is primarily
        // used to store 'profile' (the name of the chosen installation profile)
        // and 'langcode' (the code of the chosen installation language), since
        // these settings need to persist from page request to page request before
        // the database is available for storage.
'parameters' => [],
        // Whether or not the parameters have changed during the current page
        // request. For interactive installations, this will trigger a page
        // redirect.
'parameters_changed' => FALSE,
        // An array of information about the chosen installation profile. This will
        // be filled in based on the profile's .info.yml file.
'profile_info' => [],
        // An array of available installation profiles.
'profiles' => [],
        // The name of the theme to use during installation.
'theme' => 'seven',
        // The server URL where the interface translation files can be downloaded.
        // Tokens in the pattern will be replaced by appropriate values for the
        // required translation file.
'server_pattern' => 'https://ftp.drupal.org/files/translations/%core/%project/%project-%version.%language.po',
        // Installation tasks can set this to TRUE to force the page request to
        // end (even if there is no themable output), in the case of an interactive
        // installation. This is needed only rarely; for example, it would be used
        // by an installation task that prints JSON output rather than returning a
        // themed page. The most common example of this is during batch processing,
        // but the Drupal installer automatically takes care of setting this
        // parameter properly in that case, so that individual installation tasks
        // which implement the batch API do not need to set it themselves.
'stop_page_request' => FALSE,
        // Installation tasks can set this to TRUE to indicate that the task should
        // be run again, even if it normally wouldn't be. This can be used, for
        // example, if a single task needs to be spread out over multiple page
        // requests, or if it needs to perform some validation before allowing
        // itself to be marked complete. The most common examples of this are batch
        // processing and form submissions, but the Drupal installer automatically
        // takes care of setting this parameter properly in those cases, so that
        // individual installation tasks which implement the batch API or form API
        // do not need to set it themselves.
'task_not_complete' => FALSE,
        // A list of installation tasks which have already been performed during
        // the current page request.
'tasks_performed' => [],
        // An array of translation files URIs available for the installation. Keyed
        // by the translation language code.
'translations' => [],
    ];
    return $defaults;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.