You are here

public function SocialFooterPoweredByBlock::blockForm in Open Social 10.0.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_footer/src/Plugin/Block/SocialFooterPoweredByBlock.php \Drupal\social_footer\Plugin\Block\SocialFooterPoweredByBlock::blockForm()
  2. 10.1.x modules/social_features/social_footer/src/Plugin/Block/SocialFooterPoweredByBlock.php \Drupal\social_footer\Plugin\Block\SocialFooterPoweredByBlock::blockForm()
  3. 10.2.x modules/social_features/social_footer/src/Plugin/Block/SocialFooterPoweredByBlock.php \Drupal\social_footer\Plugin\Block\SocialFooterPoweredByBlock::blockForm()

Overrides BlockPluginTrait::blockForm

File

modules/social_features/social_footer/src/Plugin/Block/SocialFooterPoweredByBlock.php, line 101

Class

SocialFooterPoweredByBlock
Provides a 'Powered by' block.

Namespace

Drupal\social_footer\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $config = $this->configuration;
  $default_scheme = $this->configFactory
    ->get('system.file')
    ->get('default_scheme');
  $form['logo'] = [
    '#type' => 'managed_file',
    '#title' => $this
      ->t('Logo'),
    '#upload_location' => $default_scheme . '://',
    '#upload_validators' => [
      'file_validate_is_image' => [],
    ],
    '#default_value' => $config['logo'] ? [
      $config['logo'],
    ] : NULL,
  ];
  $form['text'] = [
    '#type' => 'text_format',
    '#title' => $this
      ->t('Text'),
    '#default_value' => $config['text']['value'],
    '#format' => $config['text']['format'],
  ];
  $form['link'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Link'),
  ];
  $form['link']['url'] = [
    '#type' => 'url',
    '#title' => $this
      ->t('URL'),
    '#default_value' => $config['link']['url'],
  ];
  $form['link']['title'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Title'),
    '#default_value' => $config['link']['title'],
  ];
  return $form;
}