From b2e88df9a4c39954dadbf80974700dbf60346731 Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Wed, 6 Mar 2024 13:20:51 +0300 Subject: [PATCH] AccessTokenModel --- .../src/Model/AccessTokenModel.php | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 com_oauthserver/administrator/src/Model/AccessTokenModel.php diff --git a/com_oauthserver/administrator/src/Model/AccessTokenModel.php b/com_oauthserver/administrator/src/Model/AccessTokenModel.php new file mode 100644 index 0000000..40267d2 --- /dev/null +++ b/com_oauthserver/administrator/src/Model/AccessTokenModel.php @@ -0,0 +1,45 @@ +loadForm('com_oauthserver.access_token', 'access_token', ['control' => 'jform', 'load_data' => $loadData]); + + if (empty($form)) { + return false; + } + + return $form; + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @throws \Exception + * @since version + */ + protected function loadFormData(): mixed + { + // Check the session for previously entered form data. + $data = Factory::getApplication()->getUserState('com_oauthserver.edit.access_token.data', []); + + if (empty($data)) { + $data = $this->getItem(); + } + + $this->preprocessData('com_oauthserver.access_token', $data); + + return $data; + } +} \ No newline at end of file