You are here

protected function alpha_pagination_handler_pagination::addOptionClasses in Views Alpha Pagination 7

Add classes to an attributes array from a view option.

Parameters

string $option: The name of the view option that contains a space separated list of classes.

array $attributes: An attributes array to add the classes to, passed by reference.

Return value

array An array of classes to be used in a render array.

1 call to alpha_pagination_handler_pagination::addOptionClasses()
alpha_pagination_handler_pagination::render in views/alpha_pagination_handler_pagination.inc
Render the alphabetic paginator

File

views/alpha_pagination_handler_pagination.inc, line 446
Definition of alpha_pagination_handler_pagination.

Class

alpha_pagination_handler_pagination
Views area handler to display an alphabetic pagination representive of the entire result set for this view and not just the limited number being displayed by the view's configuration

Code

protected function addOptionClasses($option, array &$attributes) {

  // Sanitize any classes provided for the item list.
  $classes = array_filter(explode(' ', $this->options[$option]));
  foreach ($classes as &$class) {
    $class = views_clean_css_identifier($class);
  }

  // Don't add any classes if it's empty, which will add an empty attribute.
  if ($classes) {
    if (!isset($attributes['class'])) {
      $attributes['class'] = array();
    }
    $attributes['class'] = array_unique(array_merge($attributes['class'], $classes));
  }
  return $classes;
}