public function Flexbox::getCustomClass in Views Flexbox 8
Return the token-replaced classes for the specified result.
Parameters
int $result_index: The delta of the result item to get custom classes for.
string $type: The type of custom classes to return, either "item".
Return value
string A space-delimited string of classes.
File
- src/
Plugin/ views/ style/ Flexbox.php, line 172
Class
- Flexbox
- Style plugin to render each item in a flexbox layout.
Namespace
Drupal\views_flexbox\Plugin\views\styleCode
public function getCustomClass($result_index, $type) {
$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);
}