protected function WordfilterItem::wordsToArray in Wordfilter 8.2
Helper function to transform a string of words to an array.
Parameters
$words_string: The string of words, usually separated by ", ".
Return value
array The array of words.
2 calls to WordfilterItem::wordsToArray()
- WordfilterItem::getFilterWords in src/
WordfilterItem.php - Get the filter words.
- WordfilterItem::setFilterWords in src/
WordfilterItem.php - Set the filter words.
File
- src/
WordfilterItem.php, line 144
Class
Namespace
Drupal\wordfilterCode
protected function wordsToArray($words_string) {
$words_array = !empty($words_string) ? explode(',', $words_string) : [];
$words_array = array_map('trim', $words_array);
return $words_array;
}