PHPackages                             drupal-generics/entity\_theme\_suggestions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. drupal-generics/entity\_theme\_suggestions

ActiveDrupal-module[Templating &amp; Views](/categories/templating)

drupal-generics/entity\_theme\_suggestions
==========================================

Provides theme suggestions plugin for all type of entities.

8.1.0-alpha1(8y ago)01.7k1[1 PRs](https://github.com/drupal-generics/entity_theme_suggestions/pulls)GPL-2.0+PHP

Since Dec 14Pushed 8y ago1 watchersCompare

[ Source](https://github.com/drupal-generics/entity_theme_suggestions)[ Packagist](https://packagist.org/packages/drupal-generics/entity_theme_suggestions)[ RSS](/packages/drupal-generics-entity-theme-suggestions/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Entity Theme Suggestions
------------------------

[](#entity-theme-suggestions)

This module provides a plugin which can define new theme suggestions for entities. It replaces hook\_theme\_suggetions\_alter(). The module provides a base suggestions class, "EntityThemeSuggestionsBase", that can be extended by any plugin so that it inherits the most common theme suggestions.

Usage
-----

[](#usage)

Create a class in "Plugin/ThemeSuggestions" directory structure of your module, that implements "EntityThemeSuggestionsInterface" interface. The "alterSuggestions" function should return all the theme suggestions for your entity.

To mark your class as an entity theme suggestions plugin, you have to add an annotation:

```
/**
 * @EntityThemeSuggestions(
 *   id = "your_plugin_id",
 *   entityType = "your_entity_type_id",
 *   priority = "the priority of the suggestion"
 * )
 */
```

The plugin id is required and has to be unique. The entity type is required also. The priority field is optional and set to 1 by default.

Example:
--------

[](#example)

```
