Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"

Introduction to Working with Entities in Drupal 7 Series

0 (0 Likes / 0 Dislikes)
[Drupalize.Me] [Series Introduction: Working with Entities in Drupal 7] >> In this series, Blake and I are going to be introducing the entity API in Drupal 7. We're going to make use of the core entity API. We're also going to make heavy use of the entity module from contrib, because it provides a lot of really useful functionality. In fact, we're probably going to make so much use of that module that I'd say it's safe to just pretend that there's no reason to work with entities without using the entity module from contrib. Just download it, install it, and make use of it. We're going to go through a whole bunch of terminology in this series. There's a lot to learn—entity types, bundles, properties, fields, entities— and it can get a little bit confusing, but don't worry. We'll cover all of it. We'll also take a look at how you can write code that works with existing entities in Drupal 7—like nodes and comments and users and files—and write it in a way that's it's reusable. And then we're going to take a look at the entity field query class, which makes it possible to build lists of entities in a bit more of an abstract way so that when somebody adds a new module and a new entity type, your code's still going to work no matter what that entity type is. >> After we've got a good handle on the entities that come with Core and things you can do with existing entities, we'll create our own custom video entity and take a look at what's involved in that process and what we need to do to make that happen. We'll need to look at the entity class that comes with the contrib module, the controllers, the controller for the admin UI, and then some additional support provided by the contrib module that'll do things like enable our entity to use views, be exportable, use revisions, etc. >> When we use the entity API, we got a lot of stuff for free. But we're also going to have to do some things to describe the different properties on our entities and all the metadata that's contained within that. We'll be using hook entity property info to describe those things. We're also going to look at using the metadata wrappers provided by entity module from contrib, which make it super easy to access the values of properties and fields. And also to set the values of those 2, even if you don't know what language the user prefers or even the cardinality of the field. Metadata wrappers can make it really easy to find out just about anything about your entity. >> We'll also take a look at some other examples of entities provided by other contrib modules and talk a little bit about why you might want to create your own entity or when you can just stick with plain old nodes. >> Even though the nodes system is really powerful, not all content in Drupal needs to be a node. Using the entity API, we can describe our content in different ways, without having the extra baggage of making nodes. For example, if the comment module is turned on, and your storing data is a node, those 2 systems work together. But for our video entity that we're going to create, we don't necessarily even need comments in the first place. So why make it a node and have that extra overhead? The entire concept of entities is something new for Drupal 7, and the entity API makes it pretty easy to get started using them, giving us ways to describe our content in ways other than just creating a new node. It's already being used for things like users and comments, even storing files, but it's pretty cool once you start using it to store your own data, and you'll see all the power that it provides. When you're done with this series, you'll have a very good understanding of how all of the pieces fit together. We even talk about some of the things that may not get used that often, but are still useful. [Drupalize.Me]

Video Details

Duration: 3 minutes and 52 seconds
Country: United States
Language: English
License: All rights reserved
Genre: None
Views: 129
Posted by: drupalizeme on Jul 17, 2013

In this video Blake and Joe introdoce the new Entity API series and give a high level overview of what they'll cover in the rest of the lessons.

Caption and Translate

    Sign In/Register for Dotsub to translate this video.