Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach ($form_state->getValues(['mytable','rows']) as $tablerow) {
- $tablerow['label']
- foreach ($entities as $id => $entity) {
- // TableDrag: Mark the table row as draggable.
- $form['mytable'][$id]['#attributes']['class'][] = 'draggable';
- // TableDrag: Sort the table row according to its existing/configured weight.
- $form['mytable'][$id]['#weight'] = $entity->get('weight');
- // Some table columns containing raw markup.
- $form['mytable'][$id]['label'] = array(
- '#plain_text' => $entity->label(),
- );
- $form['mytable'][$id]['id'] = array(
- '#plain_text' => $entity->id(),
- );
- // TableDrag: Weight column element.
- $form['mytable'][$id]['weight'] = array(
- '#type' => 'weight',
- '#title' => t('Weight for @title', array('@title' => $entity->label())),
- '#title_display' => 'invisible',
- '#default_value' => $entity->get('weight'),
- // Classify the weight element for #tabledrag.
- '#attributes' => array('class' => array('mytable-order-weight')),
- );
- // Operations (dropbutton) column.
- $form['mytable'][$id]['operations'] = array(
- '#type' => 'operations',
- '#links' => array(),
- );
- $form['mytable'][$id]['operations']['#links']['edit'] = array(
- 'title' => t('Edit'),
- 'url' => Url::fromRoute('mymodule.manage_edit', array('id' => $id)),
- );
- $form['mytable'][$id]['operations']['#links']['delete'] = array(
- 'title' => t('Delete'),
- 'url' => Url::fromRoute('mymodule.manage_delete', array('id' => $id)),
- );
- }
- $form['mytable'][$id]['label'] = array(
- //'#plain_text' => $entity->ref,
- '#type' => 'number',
- '#title' => "",
- '#default_value' => $entity->ref,
- '#disabled' => TRUE,
- '#access' => FALSE,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement