public function SortAddForm::form in Entity Share 8
Same name and namespace in other branches
- 8.3 modules/entity_share_server/src/Form/SortAddForm.php \Drupal\entity_share_server\Form\SortAddForm::form()
- 8.2 modules/entity_share_server/src/Form/SortAddForm.php \Drupal\entity_share_server\Form\SortAddForm::form()
Gets the actual form array to be built.
Overrides EntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- modules/
entity_share_server/ src/ Form/ SortAddForm.php, line 17
Class
- SortAddForm
- Class SortAddForm.
Namespace
Drupal\entity_share_server\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['path'] = [
'#type' => 'textfield',
'#title' => $this
->t('Path'),
'#description' => $this
->t('Enter the machine name of the field / property you want to filter on. You can reference field / property of a referenced entity. Example: uid.name for the name of the author.'),
'#required' => TRUE,
];
$form['sort_id'] = [
'#type' => 'machine_name',
'#title' => $this
->t('ID'),
'#machine_name' => [
'source' => [
'path',
],
'exists' => [
$this,
'sortExists',
],
],
];
$form['direction'] = [
'#type' => 'select',
'#title' => $this
->t('Direction'),
'#options' => $this
->getDirectionOptions(),
'#default_value' => 'ASC',
'#required' => TRUE,
];
$form['weight'] = [
'#type' => 'number',
'#title' => $this
->t('Weight'),
'#default_value' => 0,
'#required' => TRUE,
];
return $form;
}