You are here

public function DynamicLayout::setDefaultColumnClass in Dynamic Layouts 8

Set the default column class.

Parameters

string $default_column_class: The default column class we need to set.

Overrides DynamicLayoutInterface::setDefaultColumnClass

File

src/Entity/DynamicLayout.php, line 137

Class

DynamicLayout
Defines the DynamicLayout entity.

Namespace

Drupal\dynamic_layouts\Entity

Code

public function setDefaultColumnClass($default_column_class) {
  $this->default_column_class = $default_column_class;

  // Loop over the rows and their columns.
  $rows = $this
    ->getRows();
  if ($rows) {
    foreach ($rows as $row_key => $row) {
      $columns = $row[Constants::COLUMNS];
      foreach ($columns as $column_key => $column) {
        $rows[$row_key][Constants::COLUMNS][$column_key][Constants::DEFAULT_COLUMN_CLASS] = $default_column_class;
      }
    }
  }
  $this->regions = serialize($rows);
}