You are here

public function AlphaPagination::parseAttributes in Views Alpha Pagination 7.2

Parses an attribute string saved in the UI.

Parameters

string $string: The attribute string to parse.

array $tokens: An associative array of token data to use.

Return value

array A parsed attributes array.

File

src/AlphaPagination.php, line 736

Class

AlphaPagination
A base views handler for alpha pagination.

Code

public function parseAttributes($string = NULL, array $tokens = []) {
  $attributes = [];
  if (!empty($string)) {
    $parts = explode(',', $string);
    foreach ($parts as $attribute) {
      if (strpos($attribute, '|') !== FALSE) {
        list($key, $value) = explode('|', token_replace($attribute, $tokens, [
          'clear' => TRUE,
        ]));
        $attributes[$key] = $value;
      }
    }
  }
  return $attributes;
}