From d80613f9dec562b7e935ed69ad3b9fc4ff049516 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Thu, 28 Jan 2021 16:23:23 +0100 Subject: [PATCH] MDL-70429 repository_contentbank: set default returntype Credits for Alexander Bias, for sharing the patch! The content bank was designed for making easier to reuse content. So "Link to the file" should be the default option when using the contentbank repository, in order to let teachers modify their content in the content bank and update automatically it everywhere is used. --- repository/contentbank/lib.php | 9 +++++++++ repository/contentbank/tests/behat/file_update.feature | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/repository/contentbank/lib.php b/repository/contentbank/lib.php index 0982faaabbe..eb11dd2f919 100644 --- a/repository/contentbank/lib.php +++ b/repository/contentbank/lib.php @@ -107,6 +107,15 @@ class repository_contentbank extends repository { return FILE_INTERNAL | FILE_REFERENCE; } + /** + * Which return type should be selected by default. + * + * @return int + */ + public function default_returntype() { + return FILE_REFERENCE; + } + /** * Is this repository accessing private data? * diff --git a/repository/contentbank/tests/behat/file_update.feature b/repository/contentbank/tests/behat/file_update.feature index fbd7629fc97..e0c750edab3 100644 --- a/repository/contentbank/tests/behat/file_update.feature +++ b/repository/contentbank/tests/behat/file_update.feature @@ -19,7 +19,7 @@ Feature: Updating a file in the content bank after using in a course | page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 | And I log in as "admin" - Scenario: Referenced files updates alias as well + Scenario: Referenced files is the default option and updates alias as well Given I am on "Course1" course homepage And I follow "PageName1" And I navigate to "Edit settings" in current page administration @@ -27,7 +27,6 @@ Feature: Updating a file in the content bank after using in a course And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I select "Content bank" repository in file picker And I click on "package.h5p" "file" in repository content area - And I click on "Link to the file" "radio" And I click on "Select this file" "button" And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue" And I wait until the page is ready @@ -69,6 +68,7 @@ Feature: Updating a file in the content bank after using in a course And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I select "Content bank" repository in file picker And I click on "package.h5p" "file" in repository content area + And I click on "Make a copy of the file" "radio" And I click on "Select this file" "button" And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue" And I wait until the page is ready