You are here

public static function ViewsBootstrap::getColSize in Views Bootstrap 8.4

Same name and namespace in other branches
  1. 8.3 src/ViewsBootstrap.php \Drupal\views_bootstrap\ViewsBootstrap::getColSize()

Get the number of items from the column class string.

Parameters

string $size: Bootstrap grid size xs|sm|md|lg.

Return value

int|false Number of columns in a 12 column grid or false.

File

src/ViewsBootstrap.php, line 116

Class

ViewsBootstrap
The primary class for the Views Bootstrap module.

Namespace

Drupal\views_bootstrap

Code

public static function getColSize($size) {
  if (preg_match('~col-[a-z]{2}-([0-9]*)~', $size, $matches)) {
    return 12 / $matches[1];
  }
  return FALSE;
}