public function FeedbackBlock::blockForm in Feedback 3.x
Overrides BlockPluginTrait::blockForm
File
- src/
Plugin/ Block/ FeedbackBlock.php, line 117
Class
- FeedbackBlock
- Provides a 'FeedbackBlock' block.
Namespace
Drupal\feedback\Plugin\BlockCode
public function blockForm($form, FormStateInterface $form_state) {
$type = isset($this->configuration['feedback_type']) ? $this->configuration['feedback_type'] : '';
$message = $this
->t('If you experience a bug or would like to see an addition on the current page, feel free to leave us a message.');
$message = isset($this->configuration['feedback_help']) ? $this->configuration['feedback_help'] : $message;
$submit = isset($this->configuration['feedback_submit']) ? $this->configuration['feedback_submit'] : $this
->t('Send');
$feedback_types = array_map(function ($item) {
return $item['label'];
}, $this->bundleInfo
->getBundleInfo('feedback_message'));
$form['feedback_type'] = [
'#type' => 'select',
'#title' => $this
->t('Feedback type'),
'#options' => $feedback_types,
'#default_option' => $type,
'#description' => $this
->t('Select the feedback type which will be used.'),
];
$form['feedback_help'] = [
'#type' => 'textarea',
'#title' => $this
->t('Help'),
'#default_value' => $message,
'#description' => $this
->t('Feedback submission guidelines.'),
];
$form['feedback_submit'] = [
'#type' => 'textfield',
'#title' => $this
->t('Submit button'),
'#default_value' => $submit,
'#description' => $this
->t('Specify the label that will appear on the feedback submit button.'),
];
return $form;
}