$content = $contenttype->create_content($record);
if (!empty($data['filepath'])) {
+ $filename = basename($data['filepath']);
$fs = get_file_storage();
$filerecord = array(
'component' => 'contentbank',
'contextid' => $context->id,
'userid' => $data['userid'],
'itemid' => $content->get_id(),
- 'filename' => $data['contentname'],
+ 'filename' => $filename,
'filepath' => '/'
);
$fs->create_file_from_pathname($filerecord, $CFG->dirroot . $data['filepath']);
And I click on "Link" "button"
When I click on "Browse repositories..." "button"
Then I should not see "Content bank" in the ".fp-repo-area" "css_element"
+
+ Scenario: Both content name and file name are shown when a content is selected
+ Given the following "contentbank content" exist:
+ | contextlevel | reference | contenttype | user | contentname | filepath |
+ | Course | mscC1 | contenttype_h5p | admin | My content | /h5p/tests/fixtures/ipsums.h5p |
+ And I log in as "admin"
+ And I am on "MiscellaneousCourse1" course homepage
+ And I follow "Folder"
+ And I click on "Edit" "button"
+ And I click on "Add..." "button"
+ And I should see "Content bank" in the ".fp-repo-area" "css_element"
+ When I select "Content bank" repository in file picker
+ Then I should see "My content"
+ And I click on "My content" "link"
+ And I should see "Select My content"
+ And the field "Save as" matches value "ipsums.h5p"
}, false);
},
select_file: function(args) {
- var argstitle = args.title;
+ var argstitle = args.shorttitle ? args.shorttitle : args.title;
// Limit the string length so it fits nicely on mobile devices
var titlelength = 30;
if (argstitle.length > titlelength) {