- Issue created by @altcom_neil
- gaurav gupta Jaipur, Rajasthsan
Hello,
I have reviewed the issue and it is working as expected.
Thanks
If you enable the block title link functionality but do not set a 'Title Link Url' then the page where the block is placed fatal errors:
The website encountered an unexpected error. Try again later.
InvalidArgumentException: The URI '' is invalid. You must use a valid URI scheme. in Drupal\Core\Url::fromUri() (line 293 of core/lib/Drupal/Core/Url.php).
block_title_link_preprocess_block()
call_user_func_array() (Line: 261)
Create a block and place it on a page, enable the 'Block Title Link Settings' but do not set a URL.
Add a check for the URL as well as the enabled flag:
diff --git a/block_title_link.module b/block_title_link.module
index c56cfba..351ec7e 100644
--- a/block_title_link.module
+++ b/block_title_link.module
@@ -83,8 +83,8 @@ function block_title_link_preprocess_block(&$variables) {
// Blocks coming from page manager widget does not have id.
if (!empty($variables['elements']['#id'])) {
$block = Block::load($variables['elements']['#id']);
- if ($block && $block->getThirdPartySetting('block_title_link', 'title_link_enable')) {
- $tileLink = $block->getThirdPartySetting('block_title_link', 'title_link_url');
+ if ($block && $block->getThirdPartySetting('block_title_link', 'title_link_enable')
+ && ($tileLink = $block->getThirdPartySetting('block_title_link', 'title_link_url'))) {
$linkTitle = $block->getThirdPartySetting('block_title_link', 'link_title');
$linkTarget = $block->getThirdPartySetting('block_title_link', 'title_link_target');
Active
1.1
Code
Hello,
I have reviewed the issue and it is working as expected.
Thanks