You are here

public function HidePreviewConfigForm::multiline2Array in Hide Preview Button 8

Get a string from a textarea and set every new line in an array.

Parameters

string $multiline: A multi-line string from a textarea.

Return value

array Returns all the lines of the string as an array.

2 calls to HidePreviewConfigForm::multiline2Array()
HidePreviewConfigForm::submitForm in src/Form/HidePreviewConfigForm.php
Handles the post validation process.
HidePreviewConfigForm::validateForm in src/Form/HidePreviewConfigForm.php
Validates the users's input.

File

src/Form/HidePreviewConfigForm.php, line 112

Class

HidePreviewConfigForm
This class renders and manages the configuration form of the module.

Namespace

Drupal\hide_preview\Form

Code

public function multiline2Array($multiline = '') {
  $array = preg_split("/\r\n/", $multiline);
  $array = array_filter($array, [
    $this,
    'emptyStringFilter',
  ]);
  return $array;
}