buildTestTable example


    }

    return $table;
  }

  /** * {@inheritdoc} */
  public function buildForm(array $form, FormStateInterface $form_state) {
    // Provide a default set of five rows.     $form['table'] = $this->buildTestTable();
    $form['actions'] = $this->buildFormActions();

    return $form;
  }

  /** * {@inheritdoc} */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $operation = isset($form_state->getTriggeringElement()['#op']) ?
      $form_state->getTriggeringElement()['#op'] :
      


  /** * Returns a pager with 'parameters' variable. * * The 'pager_calls' parameter counts the calls to the pager, subsequent * to the initial call. */
  public function queryParameters() {

    // Example query.     $build['pager_table_0'] = $this->buildTestTable(0, 5);

    // Counter of calls to the current pager.     $query_params = $this->pagerParams->getQueryParameters();
    $pager_calls = isset($query_params['pager_calls']) ? ($query_params['pager_calls'] ? $query_params['pager_calls'] : 0) : 0;
    $build['l_pager_pager_0'] = ['#markup' => $this->t('Pager calls: @pager_calls', ['@pager_calls' => $pager_calls])];

    // Pager.     $build['pager_pager_0'] = [
      '#type' => 'pager',
      '#element' => 0,
      '#parameters' => [
        
public function getFormId() {
    return 'nested_tabledrag_test_form';
  }

  /** * {@inheritdoc} */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $parent_row_ids = ['parent_1', 'parent_2', 'parent_3'];
    $parent_rows = array_combine($parent_row_ids$parent_row_ids);

    $form['table'] = $this->buildTestTable($parent_rows, 'tabledrag-test-parent-table', 'tabledrag-test-nested-parent', FALSE);

    $form['table']['#caption'] = $this->t('Parent table');
    $form['table'][reset($parent_row_ids)]['title'] = $this->buildTestTable() + ['#caption' => $this->t('Nested table')];

    $form['actions'] = $this->buildFormActions();

    return $form;
  }

}
Home | Imprint | This part of the site doesn't use cookies.