public function EntityReferenceBrowserTableWidget::buildReplaceButton in Entity Browser - Table Layout 8
1 call to EntityReferenceBrowserTableWidget::buildReplaceButton()
- EntityReferenceBrowserTableWidget::buildTableRows in src/
Plugin/ Field/ FieldWidget/ EntityReferenceBrowserTableWidget.php
File
- src/
Plugin/ Field/ FieldWidget/ EntityReferenceBrowserTableWidget.php, line 296
Class
- EntityReferenceBrowserTableWidget
- Plugin implementation of the 'entity_reference_browser_table_widget' widget.
Namespace
Drupal\entity_browser_table\Plugin\Field\FieldWidgetCode
public function buildReplaceButton(EntityInterface $entity, array $entities, $details_id, $row_id, array $field_parents) {
return [
'#type' => 'submit',
'#value' => $this
->t('Replace'),
'#ajax' => [
'callback' => [
get_class($this),
'updateWidgetCallback',
],
'wrapper' => $details_id,
],
'#submit' => [
[
get_class($this),
'removeItemSubmit',
],
],
'#name' => $this->fieldDefinition
->getName() . '_replace_' . $entity
->id() . '_' . $row_id . '_' . md5(json_encode($field_parents)),
'#limit_validation_errors' => [
array_merge($field_parents, [
$this->fieldDefinition
->getName(),
]),
],
'#attributes' => [
'data-entity-id' => $entity
->getEntityTypeId() . ':' . $entity
->id(),
'data-row-id' => $row_id,
'class' => [
'replace-button',
],
],
'#access' => $this
->getReplaceButtonAccess($entities),
];
}