You are here

public function DynamicLayout::setDefaultRowClass in Dynamic Layouts 8

Set the default row class.

Parameters

string $default_row_class: The default row class we need to set.

Overrides DynamicLayoutInterface::setDefaultRowClass

File

src/Entity/DynamicLayout.php, line 119

Class

DynamicLayout
Defines the DynamicLayout entity.

Namespace

Drupal\dynamic_layouts\Entity

Code

public function setDefaultRowClass($default_row_class) {
  $this->default_row_class = $default_row_class;

  // Loop over the rows and find the corresponding row number.
  $rows = $this
    ->getRows();
  if ($rows) {
    foreach ($rows as $key => $row) {
      $rows[$key][Constants::DEFAULT_ROW_CLASS] = $default_row_class;
    }
  }
  $this->regions = serialize($rows);
}