You are here

public function UIkitViewGrid::getCustomClass in UIkit Components 8

Same name and namespace in other branches
  1. 8.3 uikit_views/src/Plugin/views/style/UIkitViewGrid.php \Drupal\uikit_views\Plugin\views\style\UIkitViewGrid::getCustomClass()
  2. 8.2 uikit_views/src/Plugin/views/style/UIkitViewGrid.php \Drupal\uikit_views\Plugin\views\style\UIkitViewGrid::getCustomClass()

File

uikit_views/src/Plugin/views/style/UIkitViewGrid.php, line 124

Class

UIkitViewGrid
Style plugin to render each item in a UIkit Grid component.

Namespace

Drupal\uikit_views\Plugin\views\style

Code

public function getCustomClass($result_index, $type) {
  if (isset($this->options[$type . '_class_custom'])) {
    $class = $this->options[$type . '_class_custom'];
    if ($this
      ->usesFields() && $this->view->field) {
      $class = strip_tags($this
        ->tokenizeValue($class, $result_index));
    }
    $classes = explode(' ', $class);
    foreach ($classes as &$class) {
      $class = Html::cleanCssIdentifier($class);
    }
    return implode(' ', $classes);
  }
}