displaying a particular field of a related node with Entity Reference - drupal-7

Using Drupal 7, using views i have created a related 'videos' block for various page nodes. I can get the title to show but i can't see how i can just choose to show the 'thumbnail' field for related videos. I'm using the entity reference module. Is this possible within the view?
heres the example...http://testing.odvod.ca/bishop/what-we-do/our-approach

i figured it out...
in the view i created a relationship choosing:
--Entity Reference: Referenced Entity
--A bridge to the Content entity that is referenced via field_related_videos
The added the field to view and chose the reference the desired field content with the relationship drop down.
this tutorial helped: Using Entity Reference in Views

Related

ManyToManyField is not getting saved in Wagtail Page

I have a subclass of Wagtail Page class that has field of django ManyToManyField type. When I try to create a new instance of my page object, I get a list of objects that the the ManyToManyField points to and I am able select multiple items. However, after creating that page when I try to edit the same page, it seems no data got saved for the ManyToMany field. I know in Django ModelAdmin one have to override the save_related() to save ManyToMany field data. Is there a similar method for the Wagtail Page model?
You should define the field as a ParentalManyToManyField relation, as per the example here: http://docs.wagtail.io/en/v1.13.1/getting_started/tutorial.html#categories
This is a variant of ManyToManyField which is able to keep track of the relation in memory, allowing it to work in situations such as previewing and saving as draft (where it doesn't get saved to the normal database records).
I was able to use the 'after_edit_page' and 'after_create_page' hooks to save the data for the page's ManyToMany fields.

Adding fields to a Junction Object from one of the Master-Detail relationships

In a Salesforce Junction object can I reference fields from the two Master-Detail relationships in formulas and/or the User Interface or am I going to have to switch to Apex code? I can write the apex, but I try to use the built in tools as much as possible :).
To use the examples from the Trailhead tutorials I have
1. A Job Position Object (Project Mananger, Sr Developer, etc).
2. A Posting Website Object (Monster.com, Dice.com, etc).
3. A "Job Posting" Junction Object to link the two.
Let's say I add a field to the Job Position Object called "Close Date" to keep track of the date the position closes. Can I display this field on the layout page of the Job Posting Junction object without using Apex code and/or a custom VisualForce page?
Thanks!
You can definitely do that. You can use a formula field and just reference the relationship name of the object and the field name (so for example something like Job_Position__r.Close_Date__c), or if you prefer you can use the "Insert Field" button when creating the formula which will allow you to select the object/field you want through the UI.

Drupal display views block when a referenced filter from another view is used

I have a page view(1) that filters a content type by diferent field results, one of them is a referenced entity and I'd like to display it's whole content whenever a filter by this referenced field is used.
I've created a block view(2) that displays the referenced entity and tried to use contextual filters to display it only in the results view page when it is used aa a filter but I haven't find the correct way to do this
I've tried to provide a default value for the content id from the url but I the field value responds to target_id, I've also tried to use php with something like: echo ($_GET['field_nameofthefield_target_id']) but it didn't work out
Could anyone help me with this please?
thanks a lot in advance

Node referencing: How do you display (with VIEWS) a node(edition) with all its references (articles)?

Ingredients:
Drupal7 + References + Views module installed 2 content types:
magazine issue + magazine articles (for each issue)
Article c-type has a reference field: issue_no which displays the
issue it belongs
I made a Views to display me a plain list of issues only.
Requirements
1. When I click on the issue in the issue list I want to see all its references nodes(=articles) attached
2. I need to highlight the latest issue in the list by creating a separate page VIEW on the frontpage that contains articles of the latest view.
I would appreciate any help.
Recently I have done something similar for a project. In article view page go to advanced-> add a contextual filter of issue no. In magazine issue view page in fields-> add -> add a custom text field -> rewrite results -> select Output this field as a link to link it to your article view page with argument as issue no.
For example if your article list view page is article_list, you can add a rewrite result in custom text as article_list/[field_issue_no]; where [field_issue_no] is your issue no field.

Show custom object in related list under page layout

I have been trying this whole day but cant figure out... I have custom object called Dev which has many to many relationship with Accounts... I want this object Dev to show under related list of page layout of account... But it is not showing there how can i add that to related list?
Assuming you have a lookup relation from Account to Dev and also a lookup from Dev to Account (creating your many-to-many), then this will work fine.
Try re-creating your lookup relationship from Account to Dev. Then make sure that you add the related list and add to the page layouts in steps 5 & 6:
Step 5. Add reference field to Page Layouts (Yes to All)
Step 6. Add custom related lists (Yes)
That's all you need. If, however, your many-to-many relationship is unique or otherwise configured differently (with a junction table, for example) then the above may not work for you.
We always tend to use joining objects for these relationships, obviously you can show the list of joining objects as a related list, and you could display other fields from the dev object by use of formulae.
One thing we've tended to do is create an inline VF page which can then show all of the objects related to the current record.

Resources