How to add description text to $form[$scheduler_field_group]

Created on 11 October 2024, about 1 month ago

Hi, I need to add a description text to the scheduler form group.
I found that I can add a description directly in the scheduler.module around line 195

  $form[$scheduler_field_group] = [
    '#type' => 'details',
    '#title' => t('Scheduling options'),
    '#open' => $expand_details,
    '#weight' => 35,
    '#attributes' => ['class' => ['scheduler-form']],
    '#optional' => FALSE,
    '#description' => 'Description for the scheduler group form',
  ];

But, as I don't want to patch the module itself, I thought to use a form alter on my node add/edit form

function mymodule_node_form_alter()

Trying to debug, I can't find the scheduler_field_group. How can I add a description?

💬 Support request
Status

Active

Version

2.1

Component

Code

Created by

🇩🇪Germany vistree

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @vistree
  • 🇩🇪Germany vistree

    I found a possible solution: instead of using hook_form_alter() I can add a description using hookp_reprocess_details(&$variables)

    /**
     * Implements hook_preprocess_HOOK().
     */
    function mymodule_preprocess_details(&$variables)
    {
      if (isset($variables["element"]["#id"]) && $variables["element"]["#id"] == 'edit-scheduler-settings') {
        $variables["description"] = 'Info when cronjobs are about to run';
      }
    }
    
  • 🇬🇧United Kingdom jonathan1055

    Hi vistree,

    It's good that you found a solution and thank you for posting it here, so others can benefit.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024