You are here

public function DynamicLayout::deleteRow in Dynamic Layouts 8

Delete a specific row from the layout.

Parameters

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

Overrides DynamicLayoutInterface::deleteRow

File

src/Entity/DynamicLayout.php, line 343

Class

DynamicLayout
Defines the DynamicLayout entity.

Namespace

Drupal\dynamic_layouts\Entity

Code

public function deleteRow($row_id) {

  // 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) {
      unset($rows[$key]);
    }
  }
  $this->regions = serialize($rows);
}