Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

feature #610: add setting to enable/disable link underlining #611

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions classes/toolbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,18 @@ static public function set_marketingimage($css, $marketingimage, $setting) {
return $css;
}

static public function set_underlinelinks($css, $underlinelinks, $setting) {
$tag = '[[setting:'.$setting.']]';
$replacement = 'none';

if ($underlinelinks) {
$replacement = 'underline';
}
$css = str_replace($tag, $replacement, $css);

return $css;
}

static public function set_customcss($css, $customcss) {
$tag = '[[setting:customcss]]';
$replacement = $customcss;
Expand Down
3 changes: 3 additions & 0 deletions lang/en/theme_essential.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,3 +738,6 @@
// Incourse.
$string['returntosection'] = 'Return to section {$a->section}';

// Underline links.
$string['underlinelinks'] = 'Underline links';
$string['underlinelinksdesc'] = 'Underline the links appearing in resources or activities (page, book, label, etc.).';
17 changes: 17 additions & 0 deletions less/essential/settings/theme-admin.less
Original file line number Diff line number Diff line change
Expand Up @@ -497,4 +497,21 @@ h1, h2, h3, h4, h5, h6 {

/* @end */

/* @group Underlinelinks */

.forumpost .maincontent a{
text-decoration: ~"[[setting:underlinelinks]]";
}
.contentwithoutlink a{
text-decoration: ~"[[setting:underlinelinks]]";
}
.book_content a{
text-decoration: ~"[[setting:underlinelinks]]";
}
.generalbox a{
text-decoration: ~"[[setting:underlinelinks]]";
}

/* @end */

/* @end */
16 changes: 16 additions & 0 deletions less/essential/underlinelinks.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* @group Underlinelinks */

.forumpost .maincontent a{
text-decoration: underline;
}
.contentwithoutlink a{
text-decoration: underline;
}
.book_content a{
text-decoration: underline;
}
.generalbox a{
text-decoration: underline;
}

/* @end */
5 changes: 5 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,11 @@ function theme_essential_process_css($css, $theme) {
$marketingimage = \theme_essential\toolbox::setting_file_url($setting, $setting);
$css = \theme_essential\toolbox::set_marketingimage($css, $marketingimage, $setting);

// Set links underline.
$setting = 'underlinelinks';
$underlinelinks = \theme_essential\toolbox::get_setting($setting);
$css = \theme_essential\toolbox::set_underlinelinks($css, $underlinelinks, $setting);

// Set custom CSS.
$customcss = \theme_essential\toolbox::get_setting('customcss');
$css = \theme_essential\toolbox::set_customcss($css, $customcss);
Expand Down
9 changes: 9 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);

// Underline links.
$name = 'theme_essential/underlinelinks';
$title = get_string('underlinelinks', 'theme_essential');
$description = get_string('underlinelinksdesc', 'theme_essential');
$default = false;
$setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false);
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);

// Custom CSS file.
$name = 'theme_essential/customcss';
$title = get_string('customcss', 'theme_essential');
Expand Down
15 changes: 15 additions & 0 deletions style/essential-settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -1402,4 +1402,19 @@ h6 span {
background-color: [[setting:themecolor]] !important;
}
/* @end */
/* @group Underlinelinks */
.forumpost .maincontent a{
text-decoration: [[setting:underlinelinks]];
}
.contentwithoutlink a{
text-decoration: [[setting:underlinelinks]];
}
.book_content a{
text-decoration: [[setting:underlinelinks]];
}
.generalbox a{
text-decoration: [[setting:underlinelinks]];
}
/* @end */

/* @end */