function AjaxTestController::insertLinksTableWrapper

Returns a render array of links that directly Drupal.ajax().

Return value

array Renderable array of AJAX response contents.

1 string reference to 'AjaxTestController::insertLinksTableWrapper'
ajax_test.routing.yml in core/modules/system/tests/modules/ajax_test/ajax_test.routing.yml
core/modules/system/tests/modules/ajax_test/ajax_test.routing.yml

File

core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php, line 149

Class

AjaxTestController
Provides content for dialog tests.

Namespace

Drupal\ajax_test\Controller

Code

public function insertLinksTableWrapper() : array {
  $build['links'] = [
    'ajax_target' => [
      '#markup' => '<div class="ajax-target-wrapper"><table><tbody id="ajax-target"></tbody></table></div>',
    ],
    'links' => [
      '#theme' => 'links',
      '#attached' => [
        'library' => [
          'ajax_test/ajax_insert',
        ],
      ],
    ],
  ];
  $build['links']['links']['#links']['table-row'] = [
    'title' => 'Link table-row',
    'url' => Url::fromRoute('ajax_test.ajax_render_types', [
      'type' => 'table-row',
    ]),
    'attributes' => [
      'class' => [
        'ajax-insert',
      ],
      'data-method' => 'html',
      'data-effect' => 'none',
    ],
  ];
  return $build;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.