class MySuperContentEntity implements ContentEntityInterface,
EntityChangedInterface,
EntityOwnerInterface,
RevisionLogInterface,
EntityPublishedInterface
{
use EntityChangedTrait;
use EntityPublishedTrait;
use RevisionLogEntityTrait;
}function devel_entity_test_entity_view_mode_info_alter() {}
function path_entity_base_field_info() {}
function field_entity_bundle_field_info() {}
function hook_entity_view_mode_alter() {}
...function comment_entity_insert() {}
function content_moderation_entity_update() {}
function hook_entity_create() {}
function hook_entity_load() {}
function rules_entity_view() {}
function rules_entity_delete() {}
...function commerce_payment_entity_operation() {}
...function content_moderation_entity_access() {}
...core/modules/path/src/Plugin/Field/FieldType/PathItem.php
/**
* Implements hook_entity_base_field_info().
*/
function path_entity_base_field_info(EntityTypeInterface $entity_type) {
if (in_array($entity_type->id(), ['taxonomy_term', 'node', 'media'], TRUE)) {
$fields['path'] = BaseFieldDefinition::create('path')
->setLabel(t('URL alias'))
->setTranslatable(TRUE)
->setDisplayOptions('form', [
'type' => 'path',
'weight' => 30,
])
->setDisplayConfigurable('form', TRUE)
->setComputed(TRUE);
return $fields;
}
}
/**
* Defines the 'path' entity field type.
*
* @FieldType(
* id = "path",
* label = @Translation("Path"),
* description = @Translation("An entity field containing a path alias and related data."),
* no_ui = TRUE,
* default_widget = "path",
* list_class = "\Drupal\path\Plugin\Field\FieldType\PathFieldItemList",
* constraints = {"PathAlias" = {}},
* )
*/
class PathItem extends FieldItemBase {}
/**
* Implements hook_install().
*/
function mymodule_install() {
// Different approaches for this update, see https://www.drupal.org/node/2078241.
// Create field storage for the 'completeness' base field.
$entity_manager = \Drupal::entityManager();
$definition = $entity_manager->getFieldStorageDefinitions('profile')['completeness'];
$entity_manager->onFieldStorageDefinitionCreate($definition);
}
/**
* Implements hook_uninstall().
*/
function mymodule_uninstall() {
$entity_manager = \Drupal::entityManager();
$definition = $entity_manager->getLastInstalledFieldStorageDefinitions('profile')['completeness'];
$entity_manager->onFieldStorageDefinitionDelete($definition);
}
Founder @
Co- Founder @
Vladyslav Moyseenko, a.k.a vlad.dancer
&