Score:0

Programmatically update field group description on entity view screen

sa flag

Is there a way to programmatically update the field description for a field group tab on the entity form edit view?

It feels/looks like I should be using something along the lines here

  $form_display = \Drupal::entityTypeManager()
    ->getStorage('entity_form_display')
    ->load('node.page.default');

$item = $form_display->getComponent('third_party_settings');
$item->setComponent('third_party_settings', ['field_group' => ['group_additional_body'=>['format_settings' => ['description'=> ['Fieldset Group Description]]]]);
$item-save();

Not sure how/if this is possible.

Hodba Khalaf avatar
eg flag
I think you can do that using HOOK_form_alter(). I'm not sure if it would work for your use case.
Richard avatar
sa flag
Thats an idea I had not thought of that. I was trying to do this in an install hook but maybe runtime as opposed to install time might be quicker/easer.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.