You are here

public function SocialBlockBase::blockForm in Social Feed 8

Overrides BlockPluginTrait::blockForm

3 calls to SocialBlockBase::blockForm()
FacebookPostBlock::blockForm in src/Plugin/Block/FacebookPostBlock.php
Returns the configuration form elements specific to this block plugin.
InstagramPostBlock::blockForm in src/Plugin/Block/InstagramPostBlock.php
Returns the configuration form elements specific to this block plugin.
TwitterPostBlock::blockForm in src/Plugin/Block/TwitterPostBlock.php
Returns the configuration form elements specific to this block plugin.
3 methods override SocialBlockBase::blockForm()
FacebookPostBlock::blockForm in src/Plugin/Block/FacebookPostBlock.php
Returns the configuration form elements specific to this block plugin.
InstagramPostBlock::blockForm in src/Plugin/Block/InstagramPostBlock.php
Returns the configuration form elements specific to this block plugin.
TwitterPostBlock::blockForm in src/Plugin/Block/TwitterPostBlock.php
Returns the configuration form elements specific to this block plugin.

File

src/Plugin/Block/SocialBlockBase.php, line 26

Class

SocialBlockBase
Abstract base class SocialBlockBase.

Namespace

Drupal\socialfeed\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form = parent::blockForm($form, $form_state);
  $settings = $this
    ->getConfiguration();
  $access = $this->currentUser
    ->hasPermission('administer socialfeed');
  $form['override'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Customize Feed'),
    '#default_value' => isset($settings['override']) ? $settings['override'] : FALSE,
    '#access' => $access,
  ];
  $form['overrides'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Feed Configuration'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#access' => $access,
    '#states' => [
      'invisible' => [
        ':input[name="settings[override]"]' => [
          'checked' => FALSE,
        ],
      ],
    ],
  ];
  return $form;
}