You are here

protected function GridFormController::prepareEntity in Grid builder 8

Overrides Drupal\Core\Entity\EntityFormController::prepareEntity().

Prepares the grid object filling in a few default values.

File

lib/Drupal/gridbuilder/GridFormController.php, line 23
Definition of Drupal\gridbuilder\GridFormController.

Class

GridFormController
Form controller for the grid edit/add forms.

Namespace

Drupal\gridbuilder

Code

protected function prepareEntity(EntityInterface $grid) {
  if (empty($grid->width)) {

    // Set some defaults for the user if this is a new grid.
    $grid->type = GRIDBUILDER_FLUID;
    $grid->width = 100;
    $grid->columns = 12;
    $grid->padding_width = 1.5;
    $grid->gutter_width = 2;
  }
}