You are here

function filebrowser_form_node_form_alter in Filebrowser 3.x

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

Whe can define the filebrowser fields for node dir_listing. but for the time we won't use this. We will continue to use hook_form_alter due to the the complexity of updating.

Implements hook_form_BASE_FORM_ID_alter().

Parameters

$form:

FormStateInterface $form_state: _id

File

./filebrowser.module, line 120

Code

function filebrowser_form_node_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

  /** @var NodeInterface $node */
  $node = $form_state
    ->getFormObject()
    ->getEntity();
  if ($node
    ->bundle() == 'dir_listing') {
    $form = \Drupal::service('filebrowser.manager')
      ->addFormExtraFields($form, $form_state, $node);
    $form['#entity_builders'][] = 'filebrowser_node_builder';
  }
}