Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Alternate resources: 

Work with Existing Drupal Entities

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:00
    Working with Entities in Drupal 7, Chapter 3 with Joe Shindelar
  • 0:05
    Before we dive in and start creating our own custom entities,
  • 0:09
    I want to take a look at how we can interact with the entity types
  • 0:13
    that already exist in Drupal core.
  • 0:15
    There's a bunch of them like
  • 0:16
    nodes, comments, users, and so forth.
  • 0:18
    We're going to look at using functions like entity_load,
  • 0:23
    or entity_extract_id.
  • 0:27
    In order to gather information about an entity or load in an entity
  • 0:32
    in a generic way.

Work with Existing Drupal Entities

Loading...

This lesson takes a look at working with the already existing entities in Drupal such as users and nodes and demonstrates some best practices for working with them in your own custom module. We'll focus on writing code that will work with any entity type and isn't hard coded to work with just nodes or just entities.

Additional notes:
There is a typo in the video. Joe created the variable $types = 'comment'; in one spot and then used it as entity_load($type, ... which obviously wouldn't work because the later is missing an 's' on the end. The downloadable code for this video doesn't have the typo.

Downloads: 
Log in or sign up to download companion files.
Additional resources: