0

I need to know if there is a way to create a content type and within the content type to create a field which this field should be segment.

For Example :

at the beginning i will have an image, this will be the default image. and in case i will choose an option like to display only for authenticated user another image field will be opened , and in the display all unauthenticated users will see the default image and authenticated users will see the second image.

Is there something like this ?

Thanks

  • are you using 7 or 8? – Matt Jun 27 '16 at 16:41
  • I am using on 7 But i will be glad to hear also about 8 – Haniel Bitton Jun 27 '16 at 17:40
0

You can create a template for that specific content type like

node--yourcontenttype.tpl.php

and inside you can check for the user roles like so

// Load the currently logged in user.
global $user;

// Check if the user has the 'editor' role.
if (in_array('editor', $user->roles)) {
  // print one image
} else {
  //print the other one
}
  • But in this situtation if i have multi segmentation the ui will be very long. Also in case i am pulling this data in a view i need to create a nother template for that view – Haniel Bitton Jun 28 '16 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.