National-Forestry-Authority / brms

1 stars 1 forks source link

Hide District 2 tab on Forest Reserve form #94

Closed peacog closed 1 year ago

peacog commented 1 year ago

Some Forest Reserves have two reserve serial numbers and associated district/county records. This data is in the District 2 tab on the forest reserve edit form. The District 2 tab should not be visible if it has no data, but we need an option to make it visible so that district 2 data can be added.

Image

peacog commented 1 year ago

The tabs are provided by the Field Group module. Field Group has its own form hooks that run after core form hooks, which means we can't use states in the normal way in hook_form_alter. I tried some suggestions in this issue https://www.drupal.org/project/field_group/issues/1053174#comment-12234371 but I could not make it work.

If we can't get states to work we could do it with custom javascript attached to the forest reserve form.

The toggle could be implemented like the Show row weights link that is show on draggle lists, such as a content type form display page, for example https://brms.stg.envs.utils.nfa.go.ug/admin/structure/types/manage/forest_reserve/form-display

Image

ygoex commented 1 year ago

Since we are not going to have two tabs anymore and we are going to have only one Districts tab, this ticket is obsolete.