You are here

trait CsvToArrayTrait in TagCloud 8

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

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

Hierarchy

1 file declares its use of CsvToArrayTrait
TagcloudsPageChunk.php in src/Controller/TagcloudsPageChunk.php

File

src/Controller/CsvToArrayTrait.php, line 8

Namespace

Drupal\tagclouds\Controller
View source
trait CsvToArrayTrait {

  /**
   * Returns and array of ids when given a comma separated string of ids.
   *
   * @param string $strings
   *   The string of ids eg "tag1, tag2".
   *
   * @return array
   *   An array of ids.
   */
  protected function csvToArray($strings) {
    return !empty($strings) ? explode(',', $strings) : [];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CsvToArrayTrait::csvToArray protected function Returns and array of ids when given a comma separated string of ids.