You are here

public function WorkflowAccessSettingsForm::buildForm in Workflow 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

modules/workflow_access/src/Form/WorkflowAccessSettingsForm.php, line 30

Class

WorkflowAccessSettingsForm
Provides the base form for workflow add and edit forms.

Namespace

Drupal\workflow_access\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('workflow_access.settings');
  $weight = $config
    ->get('workflow_access_priority');
  $form['workflow_access'] = [
    '#type' => 'details',
    '#open' => TRUE,
    '#title' => $this
      ->t('Workflow Access Settings'),
  ];
  $form['workflow_access']['#tree'] = TRUE;
  $url = 'https://api.drupal.org/api/drupal/core%21modules%21node%21node.api.php/function/hook_node_access_records/8';
  $form['workflow_access']['workflow_access_priority'] = [
    '#type' => 'weight',
    '#delta' => 10,
    '#title' => $this
      ->t('Workflow Access Priority'),
    '#default_value' => $weight,
    '#description' => $this
      ->t('This sets the node access priority. Changing this setting can be
         dangerous. If there is any doubt, leave it at 0.
         <a href=":url" target="_blank">Read the manual</a>.', [
      ':url' => $url,
    ]),
  ];
  return parent::buildForm($form, $form_state);
}