Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is there a way to hide the webform core pre-bulit lists without patching the core?
Currently I re-define the _webform_options_info and remove the corresponding core definition. It works, but only up till the next webform update. Is there a better way?
Comments
Comment #1
DanChadwick CreditAttribution: DanChadwick commentedYes. You're doing it wrong.
In webform.api.php, read the docblock for hook_webform_select_options_info(). Then implement it to tell webform about the custom lists you are providing, then implement the callbacks for each custom list.
Comment #3
LBiStockholm CreditAttribution: LBiStockholm as a volunteer commentedIn the doc it says "This hook provides additional lists that may be utilized". I want to remove the native lists.
But - your answer led me further to hook_webform_select_options_info_alter where I found
function hook_webform_select_options_info_alter(&$items) {
// Remove the days of the week options.
unset($items['days']);
}
..which was exactly what I needed. Thanks!