You are here

protected function FlexiformController::storeDisplays in Flexiform 7

Store the displays associated with a given flexiform.

1 call to FlexiformController::storeDisplays()
FlexiformController::save in ./flexiform.entity.inc
Overrides EntityAPIController::save().

File

./flexiform.entity.inc, line 213
flexiform.entity.inc

Class

FlexiformController
The Controller for FlexiformSubmission entities

Code

protected function storeDisplays($flexiform) {
  db_delete('flexiform_display')
    ->condition('form', $flexiform->form)
    ->execute();
  if (!empty($flexiform->displays)) {
    $query = db_insert('flexiform_display');
    $query
      ->fields(array(
      'id',
      'form',
      'display',
    ));
    foreach ($flexiform->displays as $key => $display) {
      if (($display = $flexiform
        ->getDisplay($key)) && $display
        ->isEnabled()) {
        $query
          ->values(array(
          'id' => $flexiform->id,
          'form' => $flexiform->form,
          'display' => $key,
        ));
      }
    }
    $query
      ->execute();
  }
}