<form id="<?= $form->getId() ?>" name="<?= $form->getName() ?>" enctype="<?= $form->getEncType() ?>" method="<?= $form->getMethod() ?>" action="<?= $form->getAction() ?>">
  <table class="table-row-selectable common-table" data-base-target="_next">
    <thead>
      <th><?= $this->translate('Backend') ?></th>
      <th></th>
      <th></th>
    </thead>
    <tbody>
<?php
    $backendNames = $form->getBackendOrder();
    $backendConfigs = $form->getConfig();
    for ($i = 0; $i < count($backendNames); $i++):
        $type = $backendConfigs->getSection($backendNames[$i])->get('backend');
?>
      <tr>
        <td class="action">
          <?= $this->qlink(
            $backendNames[$i],
            'config/edituserbackend',
            array('backend' => $backendNames[$i]),
            array(
                'icon'  => $type === 'external' ?
                    'magic' : ($type === 'ldap' || $type === 'msldap' ? 'sitemap' : 'database'),
                'class' => 'rowaction',
                'title' => sprintf($this->translate('Edit user backend %s'), $backendNames[$i])
            )
          ) ?>
        </td>
        <td class="icon-col text-right">
          <?= $this->qlink(
            '',
            'config/removeuserbackend',
            array('backend' => $backendNames[$i]),
            array(
                'class' => 'action-link',
                'icon'  => 'cancel',
                'title' => sprintf($this->translate('Remove user backend %s'), $backendNames[$i])
            )
          ) ?>
        </td>
        <td class="icon-col text-right" data-base-target="_self">
<?php if ($i > 0): ?>
          <button type="submit" name="backend_newpos" class="link-button icon-only animated move-up" value="<?= $this->escape(
            $backendNames[$i] . '|' . ($i - 1)
          ) ?>" title="<?= $this->translate(
            'Move up in authentication order'
          ) ?>" aria-label="<?= $this->escape(sprintf(
            $this->translate('Move user backend %s upwards'),
            $backendNames[$i]
          )) ?>">
            <?= $this->icon('up-small') ?>
          </button>
<?php endif ?>
<?php if ($i + 1 < count($backendNames)): ?>
          <button type="submit" name="backend_newpos" class="link-button icon-only animated move-down" value="<?= $this->escape(
            $backendNames[$i] . '|' . ($i + 1)
          ) ?>" title="<?= $this->translate(
            'Move down in authentication order'
          ) ?>" aria-label="<?= $this->escape(sprintf(
            $this->translate('Move user backend %s downwards'),
            $backendNames[$i]
          )) ?>">
            <?= $this->icon('down-small') ?>
          </button>
<?php endif ?>
        </td>
      </tr>
<?php endfor ?>
    </tbody>
  </table>
  <?= $form->getElement($form->getTokenElementName()) ?>
  <?= $form->getElement($form->getUidElementName()) ?>
</form>
