Skip to content
Snippets Groups Projects
Commit 90b843bb authored by Kathrin Osswald's avatar Kathrin Osswald
Browse files

Fixed bug in image area feature if link attribute was left empty.

parent 76fa4c80
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ Changes
### Unreleased
* 2020-08-27 - Fixed bug in image area feature if link attribute was left empty.
* 2020-08-27 - Fixed regression for commit Added rule to show description border for all users for restricted activities.
### Release v3.8-r3
......
......@@ -181,6 +181,10 @@ function theme_boost_campus_get_imageareacontent() {
// Get all files from filearea.
$files = $fs->get_area_files($systemcontext->id, 'theme_boost_campus', 'imageareaitems', false, 'itemid', false);
// Initialize the array which holds the image links.
$links = [];
// Initialize the array which holds the alt texts.
$alttexts = [];
// Only continue processing if there are files in the filearea.
if (!empty($files)) {
// Get the content from the setting imageareaitemsattributes and explode it to an array by the delimiter "new line".
......@@ -199,7 +203,7 @@ function theme_boost_campus_get_imageareacontent() {
} else {
$settings = explode("|", $line);
// Check if parameter 2 or 3 is set.
if (!empty($settings[1] || !empty($settings[2]))) {
if (!empty($settings[1]) || !empty($settings[2])) {
foreach ($settings as $i => $setting) {
$setting = trim($setting);
if (!empty($setting)) {
......
......@@ -36,6 +36,25 @@ Feature: Configuring the theme_boost_campus plugin for the "Additional Layout Se
Then ".imagearea img" "css_element" should exist
And "//div[contains(concat(' ',normalize-space(@class),' '),' imagearea ')]//a[contains(@href, 'http://moodle.org')]" "xpath_element" should exist
And "//div[contains(concat(' ',normalize-space(@class),' '),' imagearea ')]//img[contains(@alt, 'Moodle Logo')]" "xpath_element" should exist
When I navigate to "Appearance > Boost Campus" in site administration
And I click on "Additional Layout Settings" "link"
And I set the field "id_s_theme_boost_campus_imageareaitemsattributes" to "moodle_logo.jpg||Moodle Logo"
And I press "Save changes"
Then ".imagearea img" "css_element" should exist
And "//div[contains(concat(' ',normalize-space(@class),' '),' imagearea ')]//img[contains(@alt, 'Moodle Logo')]" "xpath_element" should exist
And "//div[contains(concat(' ',normalize-space(@class),' '),' imagearea ')]//a" "xpath_element" should not exist
When I navigate to "Appearance > Boost Campus" in site administration
And I click on "Additional Layout Settings" "link"
And I set the field "id_s_theme_boost_campus_imageareaitemsattributes" to "moodle_logo.jpg|http://moodle.org"
And I press "Save changes"
Then ".imagearea img" "css_element" should exist
And "//div[contains(concat(' ',normalize-space(@class),' '),' imagearea ')]//a[contains(@href, 'http://moodle.org')][not(@alt)]" "xpath_element" should exist
When I navigate to "Appearance > Boost Campus" in site administration
And I click on "Additional Layout Settings" "link"
And I set the field "id_s_theme_boost_campus_imageareaitemsattributes" to "moodle_logo.jpg"
And I press "Save changes"
Then "//div[contains(concat(' ',normalize-space(@class),' '),' imagearea ')]//img[not(@alt)]" "xpath_element" should exist
And "//div[contains(concat(' ',normalize-space(@class),' '),' imagearea ')]//a" "xpath_element" should not exist
# Dependent on setting "Image area items"
# This is not testable with behat.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment