You are here

public function ExtractedText::settingsForm in Search API attachments 8

Same name and namespace in other branches
  1. 9.0.x src/Plugin/Field/FieldFormatter/ExtractedText.php \Drupal\search_api_attachments\Plugin\Field\FieldFormatter\ExtractedText::settingsForm()

Returns a form to configure settings for the formatter.

Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the formatter. The field_ui module takes care of handling submitted form values.

Parameters

array $form: The form where the settings form is being included in.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form elements for the formatter settings.

Overrides FormatterBase::settingsForm

File

src/Plugin/Field/FieldFormatter/ExtractedText.php, line 261

Class

ExtractedText
File formatter displaying text extracted form attachment document.

Namespace

Drupal\search_api_attachments\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $form['excluded_extensions'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Excluded file extensions'),
    '#default_value' => $this
      ->getSetting('excluded_extensions'),
    '#size' => 80,
    '#maxlength' => 255,
    '#description' => $this
      ->t('File extensions that are excluded from indexing. Separate extensions with a space and do not include the leading dot.<br />Example: "aif art avi bmp gif ico mov oga ogv png psd ra ram rgb flv"<br />Extensions are internally mapped to a MIME type, so it is not necessary to put variations that map to the same type (e.g. tif is sufficient for tif and tiff)'),
  ];
  $form['max_filesize'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Maximum upload size'),
    '#default_value' => $this
      ->getSetting('max_filesize'),
    '#description' => $this
      ->t('Enter a value like "10 KB", "10 MB" or "10 GB" in order to restrict the max file size of files that should be indexed.<br /> Enter "0" for no limit restriction.'),
    '#size' => 10,
  ];
  $form['excluded_private'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Exclude private files'),
    '#default_value' => $this
      ->getSetting('excluded_private'),
    '#description' => $this
      ->t('Check this box if you want to exclude private files from being indexed.'),
  ];
  return $form;
}