public ModulesUninstallConfirmForm::buildForm(array $form, FormStateInterface $form_state)
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfirmFormBase::buildForm
File
- core/modules/system/src/Form/ModulesUninstallConfirmForm.php, line 125
Class
- ModulesUninstallConfirmForm
- Builds a confirmation form to uninstall selected modules.
Namespace
Drupal\system\Form
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | public function buildForm( array $form , FormStateInterface $form_state ) { // Retrieve the list of modules from the key value store. $account = $this ->currentUser()->id(); $this ->modules = $this ->keyValueExpirable->get( $account ); // Prevent this page from showing when the module list is empty. if ( empty ( $this ->modules)) { drupal_set_message( $this ->t( 'The selected modules could not be uninstalled, either due to a website problem or due to the uninstall confirmation form timing out. Please try again.' ), 'error' ); return $this ->redirect( 'system.modules_uninstall' ); } $data = system_rebuild_module_data(); $form [ 'text' ][ '#markup' ] = '<p>' . $this ->t( 'The following modules will be completely uninstalled from your site, and <em>all data from these modules will be lost</em>!' ) . '</p>' ; $form [ 'modules' ] = array ( '#theme' => 'item_list' , '#items' => array_map ( function ( $module ) use ( $data ) { return $data [ $module ]->info[ 'name' ]; }, $this ->modules), ); // List the dependent entities. $this ->addDependencyListsToForm( $form , 'module' , $this ->modules, $this ->configManager, $this ->entityManager); return parent::buildForm( $form , $form_state ); } |
Please login to continue.