public function SimplenewsSubscriptionBlock::blockForm in Simplenews 8
Same name and namespace in other branches
- 8.2 src/Plugin/Block/SimplenewsSubscriptionBlock.php \Drupal\simplenews\Plugin\Block\SimplenewsSubscriptionBlock::blockForm()
- 3.x src/Plugin/Block/SimplenewsSubscriptionBlock.php \Drupal\simplenews\Plugin\Block\SimplenewsSubscriptionBlock::blockForm()
Overrides BlockPluginTrait::blockForm
File
- src/
Plugin/ Block/ SimplenewsSubscriptionBlock.php, line 98
Class
- SimplenewsSubscriptionBlock
- Provides an 'Simplenews subscription' block with all available newsletters and an email field.
Namespace
Drupal\simplenews\Plugin\BlockCode
public function blockForm($form, FormStateInterface $form_state) {
$newsletters = simplenews_newsletter_get_visible();
foreach ($newsletters as $newsletter) {
$options[$newsletter
->id()] = $newsletter->name;
}
$form['newsletters'] = array(
'#type' => 'checkboxes',
'#title' => t('Newsletters'),
'#options' => $options,
'#required' => TRUE,
'#default_value' => $this->configuration['newsletters'],
);
$form['message'] = array(
'#type' => 'textfield',
'#title' => t('Block message'),
'#size' => 60,
'#maxlength' => 255,
'#default_value' => $this->configuration['message'],
);
$form['unique_id'] = array(
'#type' => 'textfield',
'#title' => t('Unique ID'),
'#size' => 60,
'#maxlength' => 255,
'#description' => t('Each subscription block must have a unique form ID. If no value is provided, a random ID will be generated. Use this to have a predictable, short ID, e.g. to configure this form use a CAPTCHA.'),
'#default_value' => $this->configuration['unique_id'],
);
/*if (\Drupal::moduleHandler()->moduleExists('views')) {
$form['link_previous'] = array(
'#type' => 'checkbox',
'#title' => t('Display link to previous issues'),
'#return_value' => 1,
'#default_value' => variable_get('simplenews_block_l_' . $delta, 1),
'#description' => t('Link points to newsletter/newsletter_id, which is provided by the newsletter issue list default view.'),
);
}*/
/*if (\Drupal::moduleHandler()->moduleExists('views')) {
$form['rss_feed'] = array(
'#type' => 'checkbox',
'#title' => t('Display RSS-feed icon'),
'#return_value' => 1,
'#default_value' => variable_get('simplenews_block_r_' . $delta, 1),
'#description' => t('Link points to newsletter/feed/newsletter_id, which is provided by the newsletter issue list default view.'),
);
}*/
return $form;
}