You are here

public function CopyrightFooter::blockForm in Copyright Footer 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Block/CopyrightFooter.php \Drupal\copyright_footer\Plugin\Block\CopyrightFooter::blockForm()

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/CopyrightFooter.php, line 52
Contains \Drupal\copyright_footer\Plugin\Block\CopyrightFooter.

Class

CopyrightFooter
Copyright Footer module for Block.

Namespace

Drupal\copyright_footer\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) : array {
  $form['organization_name'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Organization name'),
    '#default_value' => $this->configuration['organization_name'],
  ];
  $form['organization_url'] = [
    '#type' => 'url',
    '#title' => $this
      ->t('Organization URL'),
    '#description' => $this
      ->t('Leave blank if not necessary.'),
    '#default_value' => $this->configuration['organization_url'],
  ];
  $form['year_origin'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Year origin from'),
    '#description' => $this
      ->t('Leave blank if not necessary.'),
    '#default_value' => $this->configuration['year_origin'],
  ];
  $date = new \DateTime();
  $form['year_to_date'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Year to date'),
    '#description' => $this
      ->t('Leave blank then the current year (@year) automatically shows up.', [
      '@year' => $date
        ->format('Y'),
    ]),
    '#default_value' => $this->configuration['year_to_date'],
  ];
  $form['version'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Version'),
    '#description' => $this
      ->t('Leave blank if not necessary.'),
    '#default_value' => $this->configuration['version'],
  ];
  $form['version_url'] = [
    '#type' => 'url',
    '#title' => $this
      ->t('Version URL'),
    '#description' => $this
      ->t('Leave blank if not necessary. It works w/ the version number above.') . $this
      ->t("If you don't input the version number, this field will be simply ignored."),
    '#default_value' => $this->configuration['version_url'],
  ];
  return $form;
}