You are here

private function UserInputParserTrait::extractTextarea in Warmer 8

Same name and namespace in other branches
  1. 2.x modules/warmer_cdn/src/Plugin/warmer/UserInputParserTrait.php \Drupal\warmer_cdn\Plugin\warmer\UserInputParserTrait::extractTextarea()

Parses the string under $key in the $values collection.

Parameters

array $values: The collection of values.

$key: Indicates the element to parse.

Return value

array The parsed textarea.

2 calls to UserInputParserTrait::extractTextarea()
CdnWarmer::submitConfigurationForm in modules/warmer_cdn/src/Plugin/warmer/CdnWarmer.php
Form submission handler.
SitemapWarmer::submitConfigurationForm in modules/warmer_cdn/src/Plugin/warmer/SitemapWarmer.php
Form submission handler.

File

modules/warmer_cdn/src/Plugin/warmer/UserInputParserTrait.php, line 24

Class

UserInputParserTrait
Common methods to parse user input.

Namespace

Drupal\warmer_cdn\Plugin\warmer

Code

private function extractTextarea(array $values, $key) {
  if (!array_key_exists($key, $values)) {
    return [];
  }
  if (!is_string($values[$key])) {
    return $values[$key];
  }
  return array_filter(array_map(function ($val) {
    return trim($val, "\r");
  }, explode("\n", $values[$key])));
}