$items[]=$this->formatPlural(count($dependencies),'You must enable the @required module to install @module.','You must enable the @required modules to install @module.',array(
'@module'=>$this->modules['install'][$module],
'@required'=>implode(', ',$dependencies),
));
}
$items=$this->buildMessageList();
$form['message']=array(
'#theme'=>'item_list',
'#items'=>$items,
...
...
@@ -142,6 +134,31 @@ public function buildForm(array $form, FormStateInterface $form_state) {
returnparent::buildForm($form,$form_state);
}
/**
* Builds the message list for the confirmation form.
*
* @return MarkupInterface[]
* Array of markup for the list of messages on the form.
$items[]=$this->formatPlural(count($dependencies),'You must enable the @required module to install @module.','You must enable the @required modules to install @module.',[
'@module'=>$this->modules['install'][$module],
// It is safe to implode this because module names are not translated
return$this->t('Are you sure you wish to enable experimental modules?');
}
/**
* {@inheritdoc}
*/
publicfunctiongetFormId(){
return'system_modules_experimental_confirm_form';
}
/**
* {@inheritdoc}
*/
protectedfunctionbuildMessageList(){
drupal_set_message($this->t('<a href=":url">Experimental modules</a> are provided for testing purposes only. Use at your own risk.',[':url'=>'https://www.drupal.org/core/experimental']),'warning');
$items=parent::buildMessageList();
// Add the list of experimental modules after any other messages.
$items[]=$this->t('The following modules are experimental: @modules',['@modules'=>implode(', ',array_values($this->modules['experimental']))]);