class EmailHeaderForm in Mass Contact 8
Email header settings form.
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, LinkGeneratorTrait, RedirectDestinationTrait, UrlGeneratorTrait, StringTranslationTrait
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
- class \Drupal\mass_contact\Form\SettingsFormBase
- class \Drupal\mass_contact\Form\EmailHeaderForm
- class \Drupal\mass_contact\Form\SettingsFormBase
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
Expanded class hierarchy of EmailHeaderForm
1 file declares its use of EmailHeaderForm
- EmailHeaderFormTest.php in src/
Tests/ Form/ EmailHeaderFormTest.php
1 string reference to 'EmailHeaderForm'
File
- src/
Form/ EmailHeaderForm.php, line 10
Namespace
Drupal\mass_contact\FormView source
class EmailHeaderForm extends SettingsFormBase {
/**
* {@inheritdoc}
*/
protected function getConfigKeys() {
return [
'character_set',
'default_sender_name',
'default_sender_email',
'include_from_name',
'include_to_name',
'use_bcc',
'category_override',
];
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'mass_contact_email_header_settings';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$config = $this
->config('mass_contact.settings');
// The default character set.
$form['character_set'] = [
'#type' => 'textfield',
'#title' => $this
->t('Character set'),
'#default_value' => $config
->get('character_set'),
'#description' => $this
->t('You may specify an alternate character set to use when sending emails. If left blank, the default of UTF-8 will be used. If you are unsure of what to put here, then leave it blank. Caution: setting this may not get you the results you desire. Other modules may come along and change that value after it has been set by this module.'),
];
// The sender's name and email address.
$form['mass_contact_default_sender'] = [
'#type' => 'details',
'#open' => TRUE,
'#title' => $this
->t('Default sender information'),
'#description' => $this
->t('If anything is specified in here, it is used in place of the "Your name" and "Your email address" fields when sending the mass email. Otherwise, the sender\'s name and email address will be the default values. You must fill in both values, if you want to specify a default.'),
];
$form['mass_contact_default_sender']['default_sender_name'] = [
'#type' => 'textfield',
'#title' => $this
->t('Default sender name'),
'#default_value' => $config
->get('default_sender_name'),
'#maxlength' => 128,
'#description' => $this
->t('The optional user name to send email as. Replaces the "Your name" value when sending mass emails.'),
];
$form['mass_contact_default_sender']['default_sender_email'] = [
'#type' => 'email',
'#title' => $this
->t('Default sender email address'),
'#default_value' => $config
->get('default_sender_email'),
'#description' => $this
->t('The optional user email address to send email as. Replaces the "Your email address" value when sending mass emails.'),
];
// Sender name options.
$form['mass_contact_include_name'] = [
'#type' => 'details',
'#open' => TRUE,
'#title' => $this
->t('Include names with email addresses'),
'#description' => $this
->t("Checking either of the boxes below will include the name along with the email address, in the form of '%address'. If you have problems with sending mail, especially when your site is on a Windows server, try unchecking both checkboxes.", [
'%address' => 'User name <email.address@example.com>',
]),
];
$form['mass_contact_include_name']['include_from_name'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Include the name for the sender'),
'#default_value' => $config
->get('include_from_name'),
];
$form['mass_contact_include_name']['include_to_name'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Include the names for the recipients'),
'#default_value' => $config
->get('include_to_name'),
'#description' => $this
->t("The name used for the recipients will be their site login ID."),
];
// BCC options.
$form['use_bcc'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Send as BCC (hide recipients) by default'),
'#default_value' => $config
->get('use_bcc'),
];
// More category options.
$form['category_override'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Include category in subject line'),
'#default_value' => \Drupal::config('mass_contact.settings')
->get('category_override'),
'#description' => $this
->t("If you choose this option, the category name will be printed in square brackets preceeding the message sender's subject.\n If the message sender has multiple categories selected with this option choosen, each category will be processed separately.\n If you do not choose this option and the message sender has multiple categories selected, all users will be grouped together and the message will be sent to everyone as one group, thus reducing the likelihood of sending duplicates."),
];
return $form;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigFormBase:: |
public static | function |
Instantiates a new instance of this class. Overrides FormBase:: |
13 |
ConfigFormBase:: |
public | function | Constructs a \Drupal\system\ConfigFormBase object. | 11 |
ConfigFormBaseTrait:: |
protected | function | Retrieves a configuration object. | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
EmailHeaderForm:: |
public | function |
Form constructor. Overrides ConfigFormBase:: |
|
EmailHeaderForm:: |
protected | function |
Get config keys to save. Overrides SettingsFormBase:: |
|
EmailHeaderForm:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
FormBase:: |
protected | property | The config factory. | 1 |
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 1 |
FormBase:: |
private | function | Returns the service container. | |
FormBase:: |
protected | function | Gets the current user. | |
FormBase:: |
protected | function | Gets the request object. | |
FormBase:: |
protected | function | Gets the route match. | |
FormBase:: |
protected | function | Gets the logger for a specific channel. | |
FormBase:: |
protected | function |
Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait:: |
|
FormBase:: |
public | function | Resets the configuration factory. | |
FormBase:: |
public | function | Sets the config factory for this form. | |
FormBase:: |
public | function | Sets the request stack object to use. | |
FormBase:: |
public | function |
Form validation handler. Overrides FormInterface:: |
62 |
LinkGeneratorTrait:: |
protected | property | The link generator. | 1 |
LinkGeneratorTrait:: |
protected | function | Returns the link generator. | |
LinkGeneratorTrait:: |
protected | function | Renders a link to a route given a route name and its parameters. | |
LinkGeneratorTrait:: |
public | function | Sets the link generator service. | |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
SettingsFormBase:: |
protected | function |
Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait:: |
|
SettingsFormBase:: |
public | function |
Form submission handler. Overrides ConfigFormBase:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
UrlGeneratorTrait:: |
protected | property | The url generator. | |
UrlGeneratorTrait:: |
protected | function | Returns the URL generator service. | |
UrlGeneratorTrait:: |
public | function | Sets the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Generates a URL or path for a specific route based on the given parameters. |