Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
teraßyte Posted May 2, 2022 Posted May 2, 2022 It all started with this plugin: After seeing it I was asked if I could do the same for the solved/poll/pinned/featured icons but there's no reliable way to target only those icons (not that I can see at least) with a theme hook: {{if $row->isSolved()}} <span><span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_positive" data-ipsTooltip title='{lang="this_is_solved"}'><i class='fa fa-check'></i></span></span> {{endif}} {{if $row->mapped('poll')}} <span><span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_neutral" data-ipsTooltip title='{lang="topic_has_poll"}'><i class='fa fa-question'></i></span></span> {{endif}} {{if $row->mapped('pinned') || $row->mapped('featured') || $row->hidden() === -1 || $row->hidden() === 1}} {{if $row->hidden() === -1}} <span><span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_warning" data-ipsTooltip title='{$row->hiddenBlurb()}'><i class='fa fa-eye-slash'></i></span></span> {{elseif $row->hidden() === 1}} <span><span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_warning" data-ipsTooltip title='{lang="pending_approval"}'><i class='fa fa-warning'></i></span></span> {{elseif $row->canToggleItemModeration() and $row->itemModerationEnabled()}} <span><span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_warning" data-ipsTooltip title='{lang="topic_moderation_enabled"}'><i class='fa fa-user-times'></i></span></span> {{endif}} {{if $row->mapped('pinned')}} <span><span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_positive" data-ipsTooltip title='{lang="pinned"}'><i class='fa fa-thumb-tack'></i></span></span> {{endif}} {{if $row->mapped('featured')}} <span><span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_positive" data-ipsTooltip title='{lang="featured"}'><i class='fa fa-star'></i></span></span> {{endif}} {{endif}} As a solution for now I'm thinking of running a direct str_replace() on the outputted HTML, but if a custom theme changes even slightly the HTML there it won't work anymore. Would it be possible to add some kind of unique value to everything in a future version to make it easier to target them? Something like a data-icon="XXX" or whatever you want to add: {{if $row->mapped('pinned')}} <span data-icon="pinned"><span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_positive" data-ipsTooltip title='{lang="pinned"}'><i class='fa fa-thumb-tack'></i></span></span> {{endif}} {{if $row->mapped('featured')}} <span data-icon="featured"><span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_positive" data-ipsTooltip title='{lang="featured"}'><i class='fa fa-star'></i></span></span> {{endif}} etc. If you do implement it the question templates and all other ips apps should be updated with it, too.
Recommended Posts