MDL-67915 core_table: add support for hide and show of columns
This commit is contained in:
+16
-1
@@ -115,6 +115,14 @@ class fetch extends external_api {
|
||||
VALUE_REQUIRED,
|
||||
null
|
||||
),
|
||||
'hiddencolumns' => new external_multiple_structure(
|
||||
new external_value(
|
||||
PARAM_ALPHANUMEXT,
|
||||
'Name of column',
|
||||
VALUE_REQUIRED,
|
||||
null
|
||||
)
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -146,7 +154,8 @@ class fetch extends external_api {
|
||||
?string $firstinitial = null,
|
||||
?string $lastinitial = null,
|
||||
?int $pagenumber = null,
|
||||
?int $pagesize = null
|
||||
?int $pagesize = null,
|
||||
?array $hiddencolumns = null
|
||||
) {
|
||||
|
||||
global $PAGE;
|
||||
@@ -163,6 +172,7 @@ class fetch extends external_api {
|
||||
'lastinitial' => $lastinitial,
|
||||
'pagenumber' => $pagenumber,
|
||||
'pagesize' => $pagesize,
|
||||
'hiddencolumns' => $hiddencolumns,
|
||||
] = self::validate_parameters(self::execute_parameters(), [
|
||||
'component' => $component,
|
||||
'handler' => $handler,
|
||||
@@ -175,6 +185,7 @@ class fetch extends external_api {
|
||||
'lastinitial' => $lastinitial,
|
||||
'pagenumber' => $pagenumber,
|
||||
'pagesize' => $pagesize,
|
||||
'hiddencolumns' => $hiddencolumns,
|
||||
]);
|
||||
|
||||
$tableclass = "\\{$component}\\table\\{$handler}";
|
||||
@@ -221,6 +232,10 @@ class fetch extends external_api {
|
||||
$pagesize = 20;
|
||||
}
|
||||
|
||||
if ($hiddencolumns !== null) {
|
||||
$instance->set_hidden_columns($hiddencolumns);
|
||||
}
|
||||
|
||||
$context = $instance->get_context();
|
||||
self::validate_context($context);
|
||||
$PAGE->set_url($instance->get_base_url());
|
||||
|
||||
Reference in New Issue
Block a user