private static function ChartDataCollectorTable::buildOperationButton in Charts 8.4
Same name and namespace in other branches
- 5.0.x src/Element/ChartDataCollectorTable.php \Drupal\charts\Element\ChartDataCollectorTable::buildOperationButton()
Utility method to build a button render array for the various data table.
Operation.
1 call to ChartDataCollectorTable::buildOperationButton()
- ChartDataCollectorTable::processDataCollectorTable in src/
Element/ ChartDataCollectorTable.php - Processes the element to render a table to collect a data for the chart.
File
- src/
Element/ ChartDataCollectorTable.php, line 509
Class
- ChartDataCollectorTable
- Provides a chart data collector table form element.
Namespace
Drupal\charts\ElementCode
private static function buildOperationButton($operation, $on, $id_prefix, $wrapper_id, $index = NULL, $attributes = [], $wrapper_atrributes = []) {
$name = $id_prefix . '_' . $operation . '_' . $on;
$submit = [];
if (!is_null($index)) {
$name .= '_' . $index;
$submit['#' . $on . '_index'] = $index;
}
if ($attributes) {
$submit['#attributes'] = $attributes;
}
if ($wrapper_atrributes) {
$submit['#wrapper_attributes'] = $wrapper_atrributes;
}
$submit += [
'#type' => 'submit',
'#name' => $name,
'#value' => t('@op @on', [
'@op' => ucfirst($operation),
'@on' => $on,
]),
'#limit_validation_errors' => [],
'#submit' => [
[
get_called_class(),
'tableOperationSubmit',
],
],
'#operation' => $operation,
'#operation_on' => $on,
'#ajax' => [
'callback' => [
get_called_class(),
'ajaxRefresh',
],
'wrapper' => $wrapper_id,
'effect' => 'fade',
],
];
return $submit;
}