简体   繁体   中英

how to add custom properties in drupal8's configuration entity

I want to add custom properties in the configuration entity(user_role).

e.g. 
administrator {
    id: administrator,
    label: administrator,
    isadmin: true,
    ..,
--> client_id:1
}  

but I couldn't find how to override to existing configuration entity's properties.

so please help me.

In general entities in Drupal 8 have fields (properties) that can be attached to them and can extend their functionality.

Roles are not real entities in Drupal 7 or 8 and they are not fieldable by default. In Drupal 7 there is a user_role_field module which allows for this functionality but no equivalent in Drupal 8 exists at the moment.

As an alternative in Drupal 8 you can create fields for the user entity (included in core) and if you want Role specific fields you can assign field_permissions to each of the fields so specific roles can create/view/edit them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM