public function DynamicLayoutController::deleteColumn in Dynamic Layouts 8
Callback for deleting a column.
Parameters
string $dynamic_layout_id: The dynamic layout id.
int $column_id: The column id we need to delete.
int $row_id: The row number we need to delete the column.
Return value
object The ajax response.
1 string reference to 'DynamicLayoutController::deleteColumn'
File
- src/
Controller/ DynamicLayoutController.php, line 95
Class
- DynamicLayoutController
- DynamicLayoutController class.
Namespace
Drupal\dynamic_layouts\ControllerCode
public function deleteColumn($dynamic_layout_id, $column_id, $row_id) {
$response = new AjaxResponse();
/* @var \Drupal\dynamic_layouts\DynamicLayoutInterface $config_entity */
if ($config_entity = $this->entityTypeManager
->getStorage(Constants::DYNAMIC_LAYOUT)
->load($dynamic_layout_id)) {
// Delete the specific column from the config entity.
$config_entity
->deleteColumn($row_id, $column_id);
// Save the entity.
$config_entity
->save();
// Replace the layout form with newly updated values.
/* @var \Drupal\dynamic_layouts\Form\DynamicLayoutForm $layout_form */
$layout_form = $this->entityFormBuilder
->getForm($config_entity);
$response
->addCommand(new ReplaceCommand(Constants::DYNAMIC_LAYOUT_FORM_CLASS, $layout_form));
}
return $response;
}