MDL-84779 core_ai: Add method for getting model settings keys
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
issueNumber: MDL-84779
|
||||
notes:
|
||||
core_ai:
|
||||
- message: >-
|
||||
The method `has_model_settings` inside `core_ai\aimodel\base`
|
||||
is now determined by values returned from a new method called
|
||||
`get_model_settings`.
|
||||
type: changed
|
||||
@@ -56,6 +56,15 @@ abstract class base {
|
||||
* @return bool Whether the model has settings.
|
||||
*/
|
||||
public function has_model_settings(): bool {
|
||||
return false;
|
||||
return !empty($this->get_model_settings());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all settings that can be configured for a model.
|
||||
*
|
||||
* @return string[] Array of settings.
|
||||
*/
|
||||
public function get_model_settings(): array {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,4 +72,22 @@ class action_settings_form extends moodleform {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function get_data(): ?\stdClass {
|
||||
$data = parent::get_data();
|
||||
|
||||
if ($data) {
|
||||
if (isset($data->modeltemplate)) {
|
||||
if ($data->modeltemplate === 'custom') {
|
||||
$data->model = $data->custommodel;
|
||||
} else {
|
||||
// Set the model to the selected model template.
|
||||
$data->model = $data->modeltemplate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user