You are here

public function AmpGoogleDoubleClickBlock::blockForm in Accelerated Mobile Pages (AMP) 8.3

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

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/AmpGoogleDoubleClickBlock.php, line 52

Class

AmpGoogleDoubleClickBlock

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['google_doubleclick_id'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Google DoubleClick for Publishers Network ID'),
    '#default_value' => isset($config['google_doubleclick_id']) ? $config['google_doubleclick_id'] : '',
    '#maxlength' => 25,
    '#size' => 20,
    '#placeholder' => '/',
    '#description' => $this
      ->t('The Network ID to use on this tag. This value should begin with a /.'),
  ];
  $form['width'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Width'),
    '#default_value' => isset($config['width']) ? $config['width'] : '',
    '#maxlength' => 25,
    '#size' => 20,
  ];
  $form['height'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Height'),
    '#default_value' => isset($config['height']) ? $config['height'] : '',
    '#maxlength' => 25,
    '#size' => 20,
  ];
  $form['data_slot'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Data-slot'),
    '#default_value' => isset($config['data_slot']) ? $config['data_slot'] : '',
    '#maxlength' => 25,
    '#size' => 20,
  ];
  return $form;
}