You are here

public function vapnHandler::getDefaultsForNode in View access per node 8

File

src/vapnHandler.php, line 25

Class

vapnHandler
Class vapnHandler.

Namespace

Drupal\vapn

Code

public function getDefaultsForNode($form_state) {
  if (!($node = $form_state
    ->getFormObject()
    ->getEntity())) {
    return [];
  }
  $records = \Drupal::database()
    ->select('vapn')
    ->fields('vapn', array(
    'rid',
  ))
    ->condition('nid', $node
    ->id())
    ->execute();
  $col = $records
    ->fetchCol();
  return empty($col) ? [] : array_values($col);
}