You are here

public function DynamicLayout::setRowClasses in Dynamic Layouts 8

Set the layout row classes.

Parameters

int $row_id: The row number we need to set.

array $row_classes: The row classes we need to set.

Overrides DynamicLayoutInterface::setRowClasses

File

src/Entity/DynamicLayout.php, line 171

Class

DynamicLayout
Defines the DynamicLayout entity.

Namespace

Drupal\dynamic_layouts\Entity

Code

public function setRowClasses($row_id, array $row_classes) {
  $updated_row = $this
    ->getRowById($row_id);
  $updated_row[Constants::CUSTOM_ROW_CLASSES] = $row_classes;

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