Skip to content

Commit

Permalink
MDL-67999 core_contentbank: Add namespace to upload form
Browse files Browse the repository at this point in the history
The form to upload/replace files has been moved to classes/form
(it's where it should have been added when it was created).
Besides, this class has been renamed because now, with the
namespace, contentbank and form don't need to be in the name ;-)
  • Loading branch information
sarjona committed Apr 14, 2021
1 parent 511a87f commit 9c07064
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Upload files to content bank form
*
* @package core_contentbank
* @copyright 2020 Amaia Anabitarte <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

require_once("$CFG->libdir/formslib.php");
namespace core_contentbank\form;

/**
* Class contentbank_files_form
* Upload files to content bank form
*
* @package core_contentbank
* @copyright 2020 Amaia Anabitarte <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class contentbank_files_form extends moodleform {
class upload_files extends \moodleform {

/**
* Add elements to this form.
Expand Down
4 changes: 2 additions & 2 deletions contentbank/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

require('../config.php');
require_once("$CFG->dirroot/contentbank/files_form.php");

use core\output\notification;

Expand Down Expand Up @@ -86,7 +85,8 @@
);
file_prepare_standard_filemanager($data, 'files', $options, $context, 'contentbank', 'public', 0);

$mform = new contentbank_files_form(null, ['contextid' => $contextid, 'data' => $data, 'options' => $options, 'id' => $id]);
$customdata = ['contextid' => $contextid, 'data' => $data, 'options' => $options, 'id' => $id];
$mform = new \core_contentbank\form\upload_files(null, $customdata);

$error = '';

Expand Down

0 comments on commit 9c07064

Please sign in to comment.