I am using entity reference to refer another content type. But in the list I am getting unpublished content also. Because I have given permission to view Unpublished content, but I don't want to show them here. So how can I restrict those content from displaying in Entity referred field value.


While adding entity reference field to the content type,

In Field Setting--> Entity selection-->Mode -->Select Views and create a view by filtering only Published content, and assign the same to "View used to select the entities *"

Hope this will help you in building views link

  • This one will work thank u for this. But is there any coding I can do to achieve this.
    – Suraj
    Oct 25 '16 at 13:55
  • Create an hook_form_alter with this similar kind of code will help you $options = array($entity_node->nid => $entity_node->title); $form['field_ref_type'][LANGUAGE_NONE][0]['target_id']['#options'] = $options; $form['field_ref_type'][LANGUAGE_NONE][0]['target_id']['#default_value'] = $entity_node->nid;
    – Bipin K
    Oct 26 '16 at 4:45

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.