public function RoleListController::buildForm

Form constructor.

Parameters

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

array $form_state: An associative array containing the current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

drupal/core/modules/user/lib/Drupal/user/RoleListController.php, line 90
Contains \Drupal\user\RoleListController.

Class

RoleListController
Provides a listing of user roles.

Namespace

Drupal\user

Code

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;
}