You are here

protected function CsvToArrayTrait::csvToArray in TagCloud 8

Same name and namespace in other branches
  1. 2.0.x src/Controller/CsvToArrayTrait.php \Drupal\tagclouds\Controller\CsvToArrayTrait::csvToArray()
  2. 1.0.x src/Controller/CsvToArrayTrait.php \Drupal\tagclouds\Controller\CsvToArrayTrait::csvToArray()

Returns and array of ids when given a comma separated string of ids.

Parameters

string $strings: The string of ids eg "tag1, tag2".

Return value

array An array of ids.

2 calls to CsvToArrayTrait::csvToArray()
TagcloudsListVocs::listVocs in src/Controller/TagcloudsListVocs.php
Renders a list of vocabularies.
TagcloudsPageChunk::chunk in src/Controller/TagcloudsPageChunk.php
Renders a list of vocabularies.

File

src/Controller/CsvToArrayTrait.php, line 19

Class

CsvToArrayTrait
Provides method to convert cvs list of vocabulary id an to array.

Namespace

Drupal\tagclouds\Controller

Code

protected function csvToArray($strings) {
  return !empty($strings) ? explode(',', $strings) : [];
}