Problem/Motivation

In the NodeHtmlTitle.php such code exists:

if ($this->options['settings']['link_to_entity'] === TRUE) {

At first look, it's good and should work as expected because $this->options['settings']['link_to_entity'] can be only TRUE/FALSE. But there's a case when it can be 1 or 0, and it's very easy to reproduce.

Steps to reproduce

1. Create a view by node.
2. Configure the view to show fields.
3. "Content: Title" will be added automatically.
4. "Link to the Content" option for "Content: Title" field is already checked by default, and in the view, the preview content title is shown as a link to content.
5. Disable the option "Link to the Content" and save.
6. Enable it ( "Link to the Content") again and save.
In the view, the preview content title is not shown as a link to the content. (because after this option re-save $this->options['settings']['link_to_entity'] = 1)

Proposed resolution

Replace $this->options['settings']['link_to_entity'] === TRUE) with !empty($this->options['link_to_entity']) (based on code in the EntityLabel.php)

Issue fork html_title-3547205

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

vitaliyb98 created an issue. See original summary.

vitaliyb98’s picture

Status: Active » Needs review
vitaliyb98’s picture

It would be great if someone could review this as well.

vinodhini.e’s picture

Hi, Steps to Reproduce

Installed and tested this module on Drupal 11.2.3

Create a View of content (nodes) and configure it to display Fields.

Add the NodeHtmlTitle field (Content: Title).

Toggle the “Link to the Content” option:

Disable it → Save → title is not linked.

Enable it again → Save → previously, the title would not appear as a link (bug).

After applying Merge #28, re-enabling the option now correctly shows the title as a link. Thanks.

vitaliyb98’s picture

Status: Needs review » Fixed

Merged into 8.x-1.x, thanks

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

  • vitaliyb98 committed 4581fde6 on 8.x-1.x
    Issue #3547205 : Bug with Link to the Content option on node_html_title...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.