You are here

protected function KeywordSettingsForm::buildTable in Alinks 8

Parameters

array $form:

\Drupal\Core\Form\FormStateInterface $form_state:

Return value

array

1 call to KeywordSettingsForm::buildTable()
KeywordSettingsForm::buildForm in src/Form/KeywordSettingsForm.php
Form constructor.

File

src/Form/KeywordSettingsForm.php, line 244

Class

KeywordSettingsForm
Class KeywordSettingsForm.

Namespace

Drupal\alinks\Form

Code

protected function buildTable(FormStateInterface $form_state) {
  $form = [];
  $form['display_table'] = array(
    '#type' => 'table',
    '#header' => array(
      t('Entity type'),
      t('Entity bundle'),
      t('Display'),
      t('Operations'),
    ),
  );
  $displays = $this
    ->configFactory()
    ->getEditable('alinks.settings')
    ->get('displays');
  foreach ($displays as $key => $display) {
    $form['display_table'][$key]['entity_type'] = array(
      '#plain_text' => $display['entity_type'],
    );
    $form['display_table'][$key]['entity_bundle'] = array(
      '#plain_text' => $display['entity_bundle'],
    );
    $form['display_table'][$key]['entity_display'] = array(
      '#plain_text' => $display['entity_display'],
    );
    $form['display_table'][$key]['operations'] = array(
      '#type' => 'operations',
      '#links' => array(
        'delete' => array(
          'title' => t('Delete'),
          'url' => Url::fromRoute('alinks.alinks_controller_delete', $display),
        ),
      ),
    );
  }
  return $form;
}