Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. File.php

function File::buildOptionsForm

Provide link to file option.

Overrides FieldPluginBase::buildOptionsForm

File

core/modules/file/src/Plugin/views/field/File.php, line 76

Class

File
Field handler to provide simple renderer that allows linking to a file.

Namespace

Drupal\file\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    $form['link_to_file'] = [
        '#title' => $this->t('Link this field to download the file'),
        '#description' => $this->t("Enable to override this field's links."),
        '#type' => 'checkbox',
        '#default_value' => !empty($this->options['link_to_file']),
    ];
    parent::buildOptionsForm($form, $form_state);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal