Closed (fixed)
Project:
Protected Node
Version:
7.x-1.0
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Oct 2015 at 21:57 UTC
Updated:
7 Dec 2015 at 20:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
izus commentedif you're looking for a condition to know if a node is protected in views, then the protected_node_views submodule offers it i think (it's called Node is protected)
try to enable that submodule and then you'll have the condition.
Comment #3
Babymaggie commentedHi izus
Thanks for your reply.
The submodule is installed and the logic of the view seems to work fine.
The problem I'm getting is trying to get views to output an icon of a key instead of text, in my case {Locked}.
I would really like to be able to use the custom option of the output format to be able to accept an image? if that makes sense - unless there's an easier way?.
I expect it's me getting it wrong but no matter how I try to use views to rewrite the field with an image it just doesn't work :(
Any ideas?
Best wishes
Comment #4
grimreaperHello,
@Babymaggie: I don't understand the meaning of "an icon of a key"? For you what is the key? The password? the hashed password? The tip?
Comment #5
Babymaggie commentedHi guys
I have attached an image of what I would like to try to create.
The left image is how the view looks now, the right image is how I would like my view to look with an image/icon of a key.
Any help is greatly appreciated :)
Comment #6
drupalove commentedI understand Protected Node is working properly and you just want to replace the text with a background image, you can achieve this with CSS.
Inspect the field which outputs the text {locked} to see if there is a class we can target.
Assuming there is a class called 'locked', use the snippet below in your stylesheet and replace the dimensions of the icon.
If you inspected the field and found out there is no class, in the style settings of the field tick the checkbox 'Customize field HTML' and also tick the checkbox 'Create a CSS class'. In the field named 'CSS class' add a class called locked (without the dot).
It looks like the whole block is already centred; if the icon is not centred, add these two lines to the snippet:
If the icon is still not centred, try instead this:
If the view is not made up of fields and there is no CSS class, the approach to adding a class will be different.
If that doesn't work for you, provide a URL to the page. If it works please update this issue.
Comment #7
Babymaggie commentedHi drupalove
Many thanks for the above help, it has proved to be very useful!
The above advice works, I had to add as suggested:
margin-left: auto;
margin-right: auto;
and now it's almost what I want however the key icon is showing regardless of whether the node is locked or not.
Any ideas as to how to just display the key icon when the node is protected?
Many thanks for all the great advice so far.
Comment #8
drupalove commentedGrimreaper and Izus will be able to confirm if the module supports fields in views and they may help you while I'm away on holiday and don't have pc access yet.
Comment #9
Babymaggie commentedThanks for all your help drupalove, have a great holiday!
Cheers
Comment #10
izus commentedComment #11
grimreaperHello,
Yes using the protected_node_views sub-module, it adds views fields. One is "Protected node list: Node is protected". So you can have the output for your key image with this field.
In case it will not be enough flexible, try views conditional (https://www.drupal.org/project/views_conditional).
Comment #12
grimreaperHello,
@Babymaggie: Did this solution work for you? Can we close the issue?
Comment #13
Babymaggie commentedHi Grimreaper
It helped lots thanks - I had to create an extra view that uses filter criteria: Protected node list: Node is protected (Yes) and use drupalove's reply #6
It's not ideal because of having to create the extra view but it works!
Many thanks to you all
Comment #14
grimreaperHello,
Ok thanks. I mark the issue as fixed. Feel free to reopen in case of problem.
Thanks to all.