Building a Bibliography
Via Entity References and Views
Thursday, June 27, 13
Bio
Eric Aitala
Earth and Space Science
Partnership - College of
Earth & Mineral Science
ema13@psu.edu
@aitala
Drupal dev ...
Entities
Introduced in D7
An entity is a collection of information which is fieldable.
Examples
Node
Comments
Users
Taxonom...
Entities
Entity Type - Node, User, File
Bundle - Article, Basic Page
Field(s) - Body, text field, date field
Entity - A spec...
Entities
More information at:
https://drupal.org/node/1261744
http://www.slideshare.net/jdleonard/entities-in-drupal-7-
th...
Citation Example
A publication
Contains a title,
author(s), an abstract,
a publication date, etc.
Why not use Biblio
modul...
Author Field
The author field can be
quite complicated...
Thursday, June 27, 13
Author Field
If I was in a hurry...
Plain text field
Infinite instances
Thursday, June 27, 13
But.....
... you may not get
what you expect.
I’ve done this once....
... bad idea.
Thursday, June 27, 13
There is a better way...
Thursday, June 27, 13
Entity Reference
Entity reference module
https://drupal.org/project/entityreference
It provides a field which allows one en...
Citation Example, v2
Instead of having a plain text field, create two content
types
Citation
Title, abstract, etc.
Citation...
Citation Example, v2
Thursday, June 27, 13
Citation Example, v2
Add a field to the Citation type to the Citation Author
type.
Thursday, June 27, 13
Citation Example, v2
Thursday, June 27, 13
Citation Example, v2
In my real world case, I have the Citation type refer to
Citation Author type which in turn may refer...
Demo time....
Thursday, June 27, 13
Modules
Entity API
Functionality not included in D7 core
CRUD functionality, etc. (You really need this module!)
https://d...
Now... Views....?
How do we handle
things like entity
references in Views?
Under the Views
‘Advanced’ tab...
Contextual Fi...
Now... Views....?
Contextual Filter
“Contextual Filters (known in previous versions of
Views as "Arguments") are input. Wh...
Now... Views....?
Relationships
“Relationships allow you to expand the query to
include objects other than the base query....
Now... Views....?
Relationships
“A similar relationship that is not automatically made
available is for node revisions. Ea...
What does that mean?
Contextual Filter
Has query/filter terms in the URL (usually)
http://example.com/events/2013/6/25
Rela...
Demo time....
Thursday, June 27, 13
Upcoming SlideShare
Loading in...5
×

Building a Bibliography

369

Published on

Via Entity References and Views, Penn State Drupal Camp 2013 presentation


Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
369
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Building a Bibliography

  1. 1. Building a Bibliography Via Entity References and Views Thursday, June 27, 13
  2. 2. Bio Eric Aitala Earth and Space Science Partnership - College of Earth & Mineral Science ema13@psu.edu @aitala Drupal dev since 2006 Thursday, June 27, 13
  3. 3. Entities Introduced in D7 An entity is a collection of information which is fieldable. Examples Node Comments Users Taxonomy vocabulary & taxonomy term File Thursday, June 27, 13
  4. 4. Entities Entity Type - Node, User, File Bundle - Article, Basic Page Field(s) - Body, text field, date field Entity - A specific instance of an entity type or bundle i.e. example.com/node/27 Stores data (properties) in the database. Fields provide additional properties to extend the default bundle(s). Thursday, June 27, 13
  5. 5. Entities More information at: https://drupal.org/node/1261744 http://www.slideshare.net/jdleonard/entities-in-drupal-7- the-entity-api Thursday, June 27, 13
  6. 6. Citation Example A publication Contains a title, author(s), an abstract, a publication date, etc. Why not use Biblio module? Its wonky... Create a content type for it.... Thursday, June 27, 13
  7. 7. Author Field The author field can be quite complicated... Thursday, June 27, 13
  8. 8. Author Field If I was in a hurry... Plain text field Infinite instances Thursday, June 27, 13
  9. 9. But..... ... you may not get what you expect. I’ve done this once.... ... bad idea. Thursday, June 27, 13
  10. 10. There is a better way... Thursday, June 27, 13
  11. 11. Entity Reference Entity reference module https://drupal.org/project/entityreference It provides a field which allows one entity to refer to another... aka, a specific node can point, via a link for example, to another node. Integrates with Views, Feeds, and Migrate module Thursday, June 27, 13
  12. 12. Citation Example, v2 Instead of having a plain text field, create two content types Citation Title, abstract, etc. Citation Author Name, degrees, affiliation, etc. Then have the Citation do an Entity Reference to the Citation Author(s) Thursday, June 27, 13
  13. 13. Citation Example, v2 Thursday, June 27, 13
  14. 14. Citation Example, v2 Add a field to the Citation type to the Citation Author type. Thursday, June 27, 13
  15. 15. Citation Example, v2 Thursday, June 27, 13
  16. 16. Citation Example, v2 In my real world case, I have the Citation type refer to Citation Author type which in turn may refer to a User entity! Thursday, June 27, 13
  17. 17. Demo time.... Thursday, June 27, 13
  18. 18. Modules Entity API Functionality not included in D7 core CRUD functionality, etc. (You really need this module!) https://drupal.org/project/entity Entity Reference https://drupal.org/project/entityreference Entity Reference Dynamic Select Widget https://drupal.org/project/entityreference_dynamicselect_widget References dialog - adds the create & edit inline links https://drupal.org/project/references_dialog Thursday, June 27, 13
  19. 19. Now... Views....? How do we handle things like entity references in Views? Under the Views ‘Advanced’ tab... Contextual Filter Relationships Thursday, June 27, 13
  20. 20. Now... Views....? Contextual Filter “Contextual Filters (known in previous versions of Views as "Arguments") are input. While they often come from the URL, they don't always. Don't be shocked when they don't. Each display type may have its own source for contextual filters.” Thursday, June 27, 13
  21. 21. Now... Views....? Relationships “Relationships allow you to expand the query to include objects other than the base query.” “The main example of the relationship that is there by default is the node --> user relationship; every node has an author, and if a node is in the query, the user who wrote that node is automatically made available.” Thursday, June 27, 13
  22. 22. Now... Views....? Relationships “A similar relationship that is not automatically made available is for node revisions. Each revision has its own author, which is the user who made the revision. By adding the "Node revision: User" relationship, all of the 'user' fields, sorts, filters and arguments available to a user will now be available for the revision author.” Thursday, June 27, 13
  23. 23. What does that mean? Contextual Filter Has query/filter terms in the URL (usually) http://example.com/events/2013/6/25 Relationships Exploit a default relationship - node and node author Create a relationship between entities - a file and the node it is attached to, or vice versa Thursday, June 27, 13
  24. 24. Demo time.... Thursday, June 27, 13

×