Problem/Motivation

Now all tags is been shown whether tag has content attached or not.

Proposed resolution

Show only tags which has attached contents.

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

    manojapare created an issue. See original summary.

    dishabhadra’s picture

    Assigned: Unassigned » dishabhadra
    padma28’s picture

    Assigned: dishabhadra » padma28
    padma28’s picture

    Added patch for show only tags which has attached contents. Please review.
    Thanks.

    padma28’s picture

    Status: Active » Needs review
    nkoporec’s picture

    Hi @padma28, tested the patch and it's working as expected.

    nkoporec’s picture

    Status: Needs review » Reviewed & tested by the community
    manojapare’s picture

    Status: Reviewed & tested by the community » Needs work

    @padma28

    Please find review feedback:

    1. In single line itself we can write select statement, instead creating a unneccessary variable DB connection object. Since we are using it in multiple places. Like
      \Drupal::database()->select('taxonomy_index', 'ti');
      
    2. PHPCS: Expected 1 space after IF keyword.

    Also, it would be better to keep one configuration check box to exclude orphan tags based on taxonomy_index table data.

    dhruveshdtripathi’s picture

    Assigned: padma28 » Unassigned
    Status: Needs work » Needs review
    StatusFileSize
    new1.47 KB
    new1.08 KB

    Made changes suggested in comment #8

    Please review.

    Thanks!

    manojapare’s picture

    Status: Needs review » Needs work

    Patch is missing configuration to exclude orphan tags.

    dishabhadra’s picture

    Status: Needs work » Needs review
    StatusFileSize
    new1.33 KB

    I added patch to remove the terms with are not attached with any node content.

    I am checking node status as well. If it's status is unpublished then not listing that term.

    Kindly review my patch.

    manojapare’s picture

    Status: Needs review » Needs work

    @dishabhadra

    Thanks for the patch. It looks fine.

    But from taxonomy index table we get only taxonomies associated with nodes. What if the user wants tag cloud attached to any entity like file entity.

    In this case, we need one configuration where the user can select exclude orphan tags.

    manojapare’s picture

    dishabhadra’s picture

    Assigned: Unassigned » dishabhadra
    manojapare’s picture

    Assigned: dishabhadra » Unassigned