Form constructor.
array $form: An associative array containing the structure of the form.
array $form_state: An associative array containing the current state of the form.
array The form structure.
Overrides FormInterface::buildForm
public function buildForm(array $form, array &$form_state) {
$form['entities'] = array(
'#type' => 'table',
'#header' => $this
->buildHeader(),
'#empty' => t('There is no @label yet.', array(
'@label' => $this->entityInfo['label'],
)),
'#tabledrag' => array(
array(
'order',
'sibling',
'weight',
),
),
);
foreach ($this
->load() as $entity) {
$form['entities'][$entity
->id()] = $this
->buildRow($entity);
}
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save order'),
'#button_type' => 'primary',
);
return $form;
}