On this page
Entity List Field Developer Documentation
Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites
Extending the class
If you want to use your own class for the Entity List field formatter, write a module with a class that extends EntityListFieldList...
class MyClass extends EntityListFieldList {}
...and configure your field instance so it uses your class. You’ll see the List class setting at the bottom of the settings form when you create an Entity List field.
Registering your class
For compatibility with entity_lister, you must also add your class to the allowed classes like so...
EntityLister::addAllowedClass('MyClass');
A good place to add that line of code is in your module's hook_enable implementation. You should call removeAllowedClass in your hook_disable to clean up the variable set in addAllowedClass. See the addAllowedClass and removeAllowedClass methods in the EntityLister class.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion