You are here

public function PrivateMessageNotificationBlock::blockForm in Private Message 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Block/PrivateMessageNotificationBlock.php \Drupal\private_message\Plugin\Block\PrivateMessageNotificationBlock::blockForm()

Returns the configuration form elements specific to this block plugin.

Blocks that need to add form elements to the normal block configuration form should implement this method.

Parameters

array $form: The form definition array for the block configuration form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The renderable form array representing the entire configuration form.

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/PrivateMessageNotificationBlock.php, line 143

Class

PrivateMessageNotificationBlock
Provides the private message notification block.

Namespace

Drupal\private_message\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form = parent::blockForm($form, $form_state);
  $config = $this
    ->getConfiguration();
  $form['ajax_refresh_rate'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Ajax refresh rate'),
    '#default_value' => $config['ajax_refresh_rate'],
    '#min' => 0,
    '#description' => $this
      ->t('The number of seconds between checks to see if there are any new messages. Setting this to a low number will result in more requests to the server, adding overhead and bandwidth. Setting this number to zero will disable ajax refresh, and the inbox will only updated if/when the page is refreshed.'),
  ];
  return $form;
}