Upgraded imagemagick and manually altered pdf to image module to handle changes....
[yaffs-website] / web / modules / contrib / entity / tests / modules / entity_module_test / src / Entity / EnhancedEntity.php
1 <?php
2
3 namespace Drupal\entity_module_test\Entity;
4
5 use Drupal\Core\Entity\EntityTypeInterface;
6 use Drupal\Core\Field\BaseFieldDefinition;
7 use Drupal\entity\Revision\RevisionableContentEntityBase;
8
9 /**
10  * Provides a test entity which uses all the capabilities of entity module.
11  *
12  * @ContentEntityType(
13  *   id = "entity_test_enhanced",
14  *   label = @Translation("Enhanced entity"),
15  *   label_collection = @Translation("Enhanced entities"),
16  *   label_singular = @Translation("enhanced entity"),
17  *   label_plural = @Translation("enhanced entities"),
18  *   label_count = @PluralTranslation(
19  *     singular = "@count enhanced entity",
20  *     plural = "@count enhanced entities",
21  *   ),
22  *   handlers = {
23  *     "storage" = "\Drupal\Core\Entity\Sql\SqlContentEntityStorage",
24  *     "access" = "\Drupal\Core\Entity\EntityAccessControlHandler",
25  *     "permission_provider" = "\Drupal\entity\EntityPermissionProvider",
26  *     "form" = {
27  *       "add" = "\Drupal\entity\Form\RevisionableContentEntityForm",
28  *       "edit" = "\Drupal\entity\Form\RevisionableContentEntityForm",
29  *       "delete" = "\Drupal\Core\Entity\EntityDeleteForm",
30  *     },
31  *     "route_provider" = {
32  *       "html" = "\Drupal\entity\Routing\DefaultHtmlRouteProvider",
33  *       "revision" = "\Drupal\entity\Routing\RevisionRouteProvider",
34  *       "delete-multiple" = "\Drupal\entity\Routing\DeleteMultipleRouteProvider",
35  *     },
36  *     "local_action_provider" = {
37  *       "collection" = "\Drupal\entity\Menu\EntityCollectionLocalActionProvider",
38  *     },
39  *     "list_builder" = "\Drupal\Core\Entity\EntityListBuilder",
40  *   },
41  *   base_table = "entity_test_enhanced",
42  *   data_table = "entity_test_enhanced_field_data",
43  *   revision_table = "entity_test_enhanced_revision",
44  *   revision_data_table = "entity_test_enhanced_field_revision",
45  *   translatable = TRUE,
46  *   revisionable = TRUE,
47  *   admin_permission = "administer entity_test_enhanced",
48  *   permission_granularity = "bundle",
49  *   entity_keys = {
50  *     "id" = "id",
51  *     "bundle" = "type",
52  *     "revision" = "vid",
53  *     "langcode" = "langcode",
54  *   },
55  *   links = {
56  *     "add-page" = "/entity_test_enhanced/add",
57  *     "add-form" = "/entity_test_enhanced/add/{type}",
58  *     "edit-form" = "/entity_test_enhanced/{entity_test_enhanced}/edit",
59  *     "canonical" = "/entity_test_enhanced/{entity_test_enhanced}",
60  *     "collection" = "/entity_test_enhanced",
61  *     "delete-multiple-form" = "/entity_test_enhanced/delete",
62  *     "revision" = "/entity_test_enhanced/{entity_test_enhanced}/revisions/{entity_test_enhanced_revision}/view",
63  *     "revision-revert-form" = "/entity_test_enhanced/{entity_test_enhanced}/revisions/{entity_test_enhanced_revision}/revert",
64  *     "version-history" = "/entity_test_enhanced/{entity_test_enhanced}/revisions",
65  *   },
66  *   bundle_entity_type = "entity_test_enhanced_bundle",
67  * )
68  */
69 class EnhancedEntity extends RevisionableContentEntityBase {
70
71   /**
72    * {@inheritdoc}
73    */
74   public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
75     $fields = parent::baseFieldDefinitions($entity_type);
76
77     $fields['name'] = BaseFieldDefinition::create('string')
78       ->setLabel('Name')
79       ->setRevisionable(TRUE)
80       ->setDisplayOptions('view', [
81         'label' => 'hidden',
82         'type' => 'string',
83         'weight' => -5,
84       ]);
85
86     return $fields;
87   }
88
89 }