You are here

public function AmpGoogleAdsenseBlock::blockForm in Accelerated Mobile Pages (AMP) 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Block/AmpGoogleAdsenseBlock.php \Drupal\amp\Plugin\Block\AmpGoogleAdsenseBlock::blockForm()

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/AmpGoogleAdsenseBlock.php, line 55

Class

AmpGoogleAdsenseBlock

Namespace

Drupal\amp\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form = parent::blockForm($form, $form_state);

  // Retrieve existing configuration for this block.
  $config = $this
    ->getConfiguration();
  $form['width'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Width'),
    '#default_value' => isset($config['width']) ? $config['width'] : '',
    '#maxlength' => 25,
    '#size' => 20,
  );
  $form['height'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Height'),
    '#default_value' => isset($config['height']) ? $config['height'] : '',
    '#maxlength' => 25,
    '#size' => 20,
  );
  $form['data_ad_slot'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Data ad slot'),
    '#default_value' => isset($config['data_ad_slot']) ? $config['data_ad_slot'] : '',
    '#maxlength' => 25,
    '#size' => 20,
  );
  return $form;
}