You are here

function filebrowser_node_prepare_form in Filebrowser 3.x

Same name and namespace in other branches
  1. 8.2 filebrowser.module \filebrowser_node_prepare_form()

Implements hook_ENTITY_TYPE_prepare_form() for node entities.

We will use this hook to set the extra filebrowser fields for an existing node. For a new node the node Form will supply de defaults @inheritdoc

File

./filebrowser.module, line 152

Code

function filebrowser_node_prepare_form(NodeInterface $node, $operation, FormStateInterface $form_state) {
  if ($node
    ->getType() == 'dir_listing' && $operation == 'edit') {
    $node->filebrowser = new Filebrowser($node
      ->id());
  }
}