I have created a pseudo field with this code:
function my_module_entity_extra_field_info() { $ extra = []; $ extra['node']['my_bundle']['display']['my_pseudo_field'] = array( 'label' => t('Pseudo Label'), 'description' => t('Pseudo description'), 'weight' => 100, 'visible' => TRUE ); return $ extra; } /** * Implements hook_ENTITY_TYPE_view(). */ function my_module_node_view(array &$ build, EntityInterface $ entity, EntityViewDisplayInterface $ display, $ view_mode, $ langcode='fr') { if ($ display->getComponent('my_pseudo_field')) { $ build['my_pseudo_field'] = [ '#type' => 'markup', '#markup' => 'This is my pseudo content', ]; } }
Everything is working fine, except that I couldn’t add it in a view.