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.
By tim.plunkett on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Description:
form_options_flatten() is a helper function for creating options suitable for HTML option groups.
This procedural function is now replaced by the flattenOptions()
method in the \Drupal\Core\Form\OptGroup
class.
It is called in the same way:
// Drupal 7
$flattened_options = form_options_flatten($options);
// Drupal 8
use Drupal\Core\Form\OptGroup;
$flattened_options = OptGroup::flattenOptions($options);
Impacts:
Module developers