Commit 40f818bb authored by webchick's avatar webchick

Issue #2221755 by grom358, ianthomas_uk: Remove uses of deprecated Element functions.

parent be83ed2b
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* Helper functions and form handlers used for the authorize.php script. * Helper functions and form handlers used for the authorize.php script.
*/ */
use Drupal\Core\Render\Element;
/** /**
* Form constructor for the file transfer authorization form. * Form constructor for the file transfer authorization form.
* *
...@@ -180,7 +182,7 @@ function _authorize_filetransfer_connection_settings_set_defaults(&$element, $ke ...@@ -180,7 +182,7 @@ function _authorize_filetransfer_connection_settings_set_defaults(&$element, $ke
// there's a subarray of settings for the form key we're currently // there's a subarray of settings for the form key we're currently
// processing, pass in that subarray to the recursive call. Otherwise, just // processing, pass in that subarray to the recursive call. Otherwise, just
// pass on the whole $defaults array. // pass on the whole $defaults array.
foreach (element_children($element) as $child_key) { foreach (Element::children($element) as $child_key) {
_authorize_filetransfer_connection_settings_set_defaults($element[$child_key], $child_key, ((isset($defaults[$key]) && is_array($defaults[$key])) ? $defaults[$key] : $defaults)); _authorize_filetransfer_connection_settings_set_defaults($element[$child_key], $child_key, ((isset($defaults[$key]) && is_array($defaults[$key])) ? $defaults[$key] : $defaults));
} }
} }
......
...@@ -3318,7 +3318,7 @@ function drupal_pre_render_link($element) { ...@@ -3318,7 +3318,7 @@ function drupal_pre_render_link($element) {
*/ */
function drupal_pre_render_links($element) { function drupal_pre_render_links($element) {
$element += array('#links' => array(), '#attached' => array()); $element += array('#links' => array(), '#attached' => array());
foreach (element_children($element) as $key) { foreach (Element::children($element) as $key) {
$child = &$element[$key]; $child = &$element[$key];
// If the child has links which have not been printed yet and the user has // If the child has links which have not been printed yet and the user has
// access to it, merge its links in to the parent. // access to it, merge its links in to the parent.
...@@ -3493,9 +3493,10 @@ function drupal_render_page($page) { ...@@ -3493,9 +3493,10 @@ function drupal_render_page($page) {
* #pre_render functions have been called, #printed is checked a second time * #pre_render functions have been called, #printed is checked a second time
* in case a #pre_render function flags the element as printed. * in case a #pre_render function flags the element as printed.
* - The child elements of this element are sorted by weight using uasort() in * - The child elements of this element are sorted by weight using uasort() in
* element_children(). Since this is expensive, when passing already sorted * \Drupal\Core\Render\Element::children(). Since this is expensive, when
* elements to drupal_render(), for example from a database query, set * passing already sorted elements to drupal_render(), for example from a
* $elements['#sorted'] = TRUE to avoid sorting them a second time. * database query, set $elements['#sorted'] = TRUE to avoid sorting them a
* second time.
* - The main render phase to produce #children for this element takes place: * - The main render phase to produce #children for this element takes place:
* - If this element has #theme defined and #theme is an implemented theme * - If this element has #theme defined and #theme is an implemented theme
* hook/suggestion then _theme() is called and must render both the element * hook/suggestion then _theme() is called and must render both the element
...@@ -3777,7 +3778,8 @@ function drupal_render(&$elements, $is_recursive_call = FALSE) { ...@@ -3777,7 +3778,8 @@ function drupal_render(&$elements, $is_recursive_call = FALSE) {
* The structured array whose children shall be rendered. * The structured array whose children shall be rendered.
* @param array $children_keys * @param array $children_keys
* (optional) If the keys of the element's children are already known, they * (optional) If the keys of the element's children are already known, they
* can be passed in to save another run of element_children(). * can be passed in to save another run of
* \Drupal\Core\Render\Element::children().
* *
* @return string * @return string
* The rendered HTML of all children of the element. * The rendered HTML of all children of the element.
...@@ -3786,7 +3788,7 @@ function drupal_render(&$elements, $is_recursive_call = FALSE) { ...@@ -3786,7 +3788,7 @@ function drupal_render(&$elements, $is_recursive_call = FALSE) {
*/ */
function drupal_render_children(&$element, $children_keys = NULL) { function drupal_render_children(&$element, $children_keys = NULL) {
if ($children_keys === NULL) { if ($children_keys === NULL) {
$children_keys = element_children($element); $children_keys = Element::children($element);
} }
$output = ''; $output = '';
foreach ($children_keys as $key) { foreach ($children_keys as $key) {
...@@ -4154,7 +4156,7 @@ function drupal_render_collect_post_render_cache(array &$elements, array $callba ...@@ -4154,7 +4156,7 @@ function drupal_render_collect_post_render_cache(array &$elements, array $callba
// Collect the #post_render_cache callbacks for all child elements, unless // Collect the #post_render_cache callbacks for all child elements, unless
// we've already collected them above by retrieving this element (and its // we've already collected them above by retrieving this element (and its
// children) from the render cache. // children) from the render cache.
if (!$retrieved_from_cache && $children = element_children($elements)) { if (!$retrieved_from_cache && $children = Element::children($elements)) {
foreach ($children as $child) { foreach ($children as $child) {
$callbacks = drupal_render_collect_post_render_cache($elements[$child], $callbacks, FALSE); $callbacks = drupal_render_collect_post_render_cache($elements[$child], $callbacks, FALSE);
} }
...@@ -4186,7 +4188,7 @@ function drupal_render_collect_attached($elements, $return = FALSE) { ...@@ -4186,7 +4188,7 @@ function drupal_render_collect_attached($elements, $return = FALSE) {
if (isset($elements['#attached'])) { if (isset($elements['#attached'])) {
$attached = drupal_merge_attached($attached, $elements['#attached']); $attached = drupal_merge_attached($attached, $elements['#attached']);
} }
if ($children = element_children($elements)) { if ($children = Element::children($elements)) {
foreach ($children as $child) { foreach ($children as $child) {
drupal_render_collect_attached($elements[$child]); drupal_render_collect_attached($elements[$child]);
} }
...@@ -4236,7 +4238,7 @@ function drupal_render_collect_cache_tags($element, $tags = array()) { ...@@ -4236,7 +4238,7 @@ function drupal_render_collect_cache_tags($element, $tags = array()) {
} }
} }
} }
if ($children = element_children($element)) { if ($children = Element::children($element)) {
foreach ($children as $child) { foreach ($children as $child) {
$tags = drupal_render_collect_cache_tags($element[$child], $tags); $tags = drupal_render_collect_cache_tags($element[$child], $tags);
} }
......
This diff is collapsed.
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Core\Render\Element;
use Drupal\Core\Template\Attribute; use Drupal\Core\Template\Attribute;
use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Cmf\Component\Routing\RouteObjectInterface;
...@@ -553,7 +554,7 @@ function menu_local_tasks($level = 0) { ...@@ -553,7 +554,7 @@ function menu_local_tasks($level = 0) {
function menu_primary_local_tasks() { function menu_primary_local_tasks() {
$links = menu_local_tasks(0); $links = menu_local_tasks(0);
// Do not display single tabs. // Do not display single tabs.
return count(element_get_visible_children($links['tabs'])) > 1 ? $links['tabs'] : ''; return count(Element::getVisibleChildren($links['tabs'])) > 1 ? $links['tabs'] : '';
} }
/** /**
...@@ -562,7 +563,7 @@ function menu_primary_local_tasks() { ...@@ -562,7 +563,7 @@ function menu_primary_local_tasks() {
function menu_secondary_local_tasks() { function menu_secondary_local_tasks() {
$links = menu_local_tasks(1); $links = menu_local_tasks(1);
// Do not display single tabs. // Do not display single tabs.
return count(element_get_visible_children($links['tabs'])) > 1 ? $links['tabs'] : ''; return count(Element::getVisibleChildren($links['tabs'])) > 1 ? $links['tabs'] : '';
} }
/** /**
......
...@@ -1323,7 +1323,7 @@ function template_preprocess_image(&$variables) { ...@@ -1323,7 +1323,7 @@ function template_preprocess_image(&$variables) {
* @see drupal_attach_tabledrag() * @see drupal_attach_tabledrag()
*/ */
function drupal_pre_render_table(array $element) { function drupal_pre_render_table(array $element) {
foreach (element_children($element) as $first) { foreach (Element::children($element) as $first) {
$row = array('data' => array()); $row = array('data' => array());
// Apply attributes of first-level elements as table row attributes. // Apply attributes of first-level elements as table row attributes.
if (isset($element[$first]['#attributes'])) { if (isset($element[$first]['#attributes'])) {
...@@ -1332,7 +1332,7 @@ function drupal_pre_render_table(array $element) { ...@@ -1332,7 +1332,7 @@ function drupal_pre_render_table(array $element) {
// Turn second-level elements into table row columns. // Turn second-level elements into table row columns.
// @todo Do not render a cell for children of #type 'value'. // @todo Do not render a cell for children of #type 'value'.
// @see http://drupal.org/node/1248940 // @see http://drupal.org/node/1248940
foreach (element_children($element[$first]) as $second) { foreach (Element::children($element[$first]) as $second) {
// Assign the element by reference, so any potential changes to the // Assign the element by reference, so any potential changes to the
// original element are taken over. // original element are taken over.
$column = array('data' => &$element[$first][$second]); $column = array('data' => &$element[$first][$second]);
...@@ -1349,7 +1349,7 @@ function drupal_pre_render_table(array $element) { ...@@ -1349,7 +1349,7 @@ function drupal_pre_render_table(array $element) {
} }
// Take over $element['#id'] as HTML ID attribute, if not already set. // Take over $element['#id'] as HTML ID attribute, if not already set.
element_set_attributes($element, array('id')); Element::setAttributes($element, array('id'));
// Add sticky headers, if applicable. // Add sticky headers, if applicable.
...@@ -1682,8 +1682,9 @@ function template_preprocess_item_list(&$variables) { ...@@ -1682,8 +1682,9 @@ function template_preprocess_item_list(&$variables) {
// child elements of the nested list, instead of #items. For // child elements of the nested list, instead of #items. For
// convenience, we automatically move them into #items. // convenience, we automatically move them into #items.
if (!isset($child['#items'])) { if (!isset($child['#items'])) {
// This is the same condition as in element_children(), which cannot // This is the same condition as in
// be used here, since it triggers an error on string values. // \Drupal\Core\Render\Element::children(), which cannot be used
// here, since it triggers an error on string values.
foreach ($child as $child_key => $child_value) { foreach ($child as $child_key => $child_value) {
if ($child_key[0] !== '#') { if ($child_key[0] !== '#') {
$child['#items'][$child_key] = $child_value; $child['#items'][$child_key] = $child_value;
...@@ -2405,9 +2406,9 @@ function template_preprocess_field(&$variables, $hook) { ...@@ -2405,9 +2406,9 @@ function template_preprocess_field(&$variables, $hook) {
// We want other preprocess functions and the theme implementation to have // We want other preprocess functions and the theme implementation to have
// fast access to the field item render arrays. The item render array keys // fast access to the field item render arrays. The item render array keys
// (deltas) should always be numerically indexed starting from 0, and looping // (deltas) should always be numerically indexed starting from 0, and looping
// on those keys is faster than calling element_children() or looping on all // on those keys is faster than calling
// keys within $element, since that requires traversal of all element // \Drupal\Core\Render\Element::children() or looping on all keys within
// properties. // $element, since that requires traversal of all element properties.
$variables['items'] = array(); $variables['items'] = array();
$delta = 0; $delta = 0;
while (!empty($element[$delta])) { while (!empty($element[$delta])) {
......
...@@ -39,7 +39,7 @@ public static function sortByWeightElement(array $a, array $b) { ...@@ -39,7 +39,7 @@ public static function sortByWeightElement(array $a, array $b) {
/** /**
* Sorts a structured array by '#weight' property. * Sorts a structured array by '#weight' property.
* *
* Callback for uasort() within element_children(). * Callback for uasort() within \Drupal\Core\Render\Element::children().
* *
* @param array $a * @param array $a
* First item for comparison. The compared items should be associative * First item for comparison. The compared items should be associative
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormBase;
use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Render\Element;
/** /**
* Base class for entity form controllers. * Base class for entity form controllers.
...@@ -186,7 +187,7 @@ protected function actionsElement(array $form, array &$form_state) { ...@@ -186,7 +187,7 @@ protected function actionsElement(array $form, array &$form_state) {
} }
$count = 0; $count = 0;
foreach (element_children($element) as $action) { foreach (Element::children($element) as $action) {
$element[$action] += array( $element[$action] += array(
'#type' => 'submit', '#type' => 'submit',
'#weight' => ++$count * 5, '#weight' => ++$count * 5,
......
...@@ -95,7 +95,7 @@ public static function children(array &$elements, $sort = FALSE) { ...@@ -95,7 +95,7 @@ public static function children(array &$elements, $sort = FALSE) {
uasort($children, 'Drupal\Component\Utility\SortArray::sortByWeightProperty'); uasort($children, 'Drupal\Component\Utility\SortArray::sortByWeightProperty');
// Put the sorted children back into $elements in the correct order, to // Put the sorted children back into $elements in the correct order, to
// preserve sorting if the same element is passed through // preserve sorting if the same element is passed through
// element_children() twice. // \Drupal\Core\Render\Element::children() twice.
foreach ($children as $key => $child) { foreach ($children as $key => $child) {
unset($elements[$key]); unset($elements[$key]);
$elements[$key] = $child; $elements[$key] = $child;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\Core\Render\Element;
/** /**
* Prepares variables for aggregator item templates. * Prepares variables for aggregator item templates.
...@@ -86,7 +87,7 @@ function theme_aggregator_page_opml($variables) { ...@@ -86,7 +87,7 @@ function theme_aggregator_page_opml($variables) {
function template_preprocess_aggregator_summary_items(&$variables) { function template_preprocess_aggregator_summary_items(&$variables) {
$variables['title'] = String::checkPlain($variables['source']->label()); $variables['title'] = String::checkPlain($variables['source']->label());
$summary_items = array(); $summary_items = array();
foreach (element_children($variables['summary_items']) as $key) { foreach (Element::children($variables['summary_items']) as $key) {
$summary_items[] = $variables['summary_items'][$key]; $summary_items[] = $variables['summary_items'][$key];
} }
$variables['summary_list'] = array( $variables['summary_list'] = array(
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* Administration page callbacks for the Book module. * Administration page callbacks for the Book module.
*/ */
use Drupal\Core\Render\Element;
/** /**
* Returns HTML for a book administration form. * Returns HTML for a book administration form.
* *
...@@ -23,7 +25,7 @@ function theme_book_admin_table($variables) { ...@@ -23,7 +25,7 @@ function theme_book_admin_table($variables) {
$rows = array(); $rows = array();
$destination = drupal_get_destination(); $destination = drupal_get_destination();
$access = \Drupal::currentUser()->hasPermission('administer nodes'); $access = \Drupal::currentUser()->hasPermission('administer nodes');
foreach (element_children($form) as $key) { foreach (Element::children($form) as $key) {
$nid = $form[$key]['nid']['#value']; $nid = $form[$key]['nid']['#value'];
$href = \Drupal::url('node.view', array('node' => $nid)); $href = \Drupal::url('node.view', array('node' => $nid));
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
use Drupal\book\BookManagerInterface; use Drupal\book\BookManagerInterface;
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Render\Element;
use Drupal\node\NodeInterface; use Drupal\node\NodeInterface;
use Drupal\node\NodeTypeInterface; use Drupal\node\NodeTypeInterface;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
...@@ -384,7 +385,7 @@ function template_preprocess_book_all_books_block(&$variables) { ...@@ -384,7 +385,7 @@ function template_preprocess_book_all_books_block(&$variables) {
// Remove all non-renderable elements. // Remove all non-renderable elements.
$elements = $variables['book_menus']; $elements = $variables['book_menus'];
$variables['book_menus'] = array(); $variables['book_menus'] = array();
foreach (element_children($elements) as $index) { foreach (Element::children($elements) as $index) {
$variables['book_menus'][$index] = $elements[$index]; $variables['book_menus'][$index] = $elements[$index];
} }
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
use Drupal\Component\Utility\Crypt; use Drupal\Component\Utility\Crypt;
use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormBase;
use Drupal\Core\Render\Element;
use Drupal\node\NodeInterface; use Drupal\node\NodeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -97,7 +98,7 @@ public function submitForm(array &$form, array &$form_state) { ...@@ -97,7 +98,7 @@ public function submitForm(array &$form, array &$form_state) {
$order = array_flip(array_keys($form_state['input']['table'])); $order = array_flip(array_keys($form_state['input']['table']));
$form['table'] = array_merge($order, $form['table']); $form['table'] = array_merge($order, $form['table']);
foreach (element_children($form['table']) as $key) { foreach (Element::children($form['table']) as $key) {
if ($form['table'][$key]['#item']) { if ($form['table'][$key]['#item']) {
$row = $form['table'][$key]; $row = $form['table'][$key];
$values = $form_state['values']['table'][$key]; $values = $form_state['values']['table'][$key];
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
use Drupal\ckeditor\CKEditorPluginManager; use Drupal\ckeditor\CKEditorPluginManager;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageManager; use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Render\Element;
use Drupal\editor\Plugin\EditorBase; use Drupal\editor\Plugin\EditorBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\editor\Entity\Editor as EditorEntity; use Drupal\editor\Entity\Editor as EditorEntity;
...@@ -165,7 +166,7 @@ public function settingsForm(array $form, array &$form_state, EditorEntity $edit ...@@ -165,7 +166,7 @@ public function settingsForm(array $form, array &$form_state, EditorEntity $edit
), ),
); );
$this->ckeditorPluginManager->injectPluginSettingsForm($form, $form_state, $editor); $this->ckeditorPluginManager->injectPluginSettingsForm($form, $form_state, $editor);
if (count(element_children($form['plugins'])) === 0) { if (count(Element::children($form['plugins'])) === 0) {
unset($form['plugins']); unset($form['plugins']);
unset($form['plugin_settings']); unset($form['plugin_settings']);
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\field\FieldInstanceConfigInterface; use Drupal\field\FieldInstanceConfigInterface;
use Drupal\field\FieldConfigInterface; use Drupal\field\FieldConfigInterface;
...@@ -1387,7 +1388,7 @@ function template_preprocess_comment(&$variables) { ...@@ -1387,7 +1388,7 @@ function template_preprocess_comment(&$variables) {
} }
// Helpful $content variable for templates. // Helpful $content variable for templates.
foreach (element_children($variables['elements']) as $key) { foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key]; $variables['content'][$key] = $variables['elements'][$key];
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder; use Drupal\Core\Entity\EntityViewBuilder;
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\Core\Render\Element;
/** /**
* Render controller for contact messages. * Render controller for contact messages.
...@@ -44,7 +45,7 @@ public function view(EntityInterface $entity, $view_mode = 'full', $langcode = N ...@@ -44,7 +45,7 @@ public function view(EntityInterface $entity, $view_mode = 'full', $langcode = N
if ($view_mode == 'mail') { if ($view_mode == 'mail') {
// Convert field labels into headings. // Convert field labels into headings.
// @todo Improve drupal_html_to_text() to convert DIVs correctly. // @todo Improve drupal_html_to_text() to convert DIVs correctly.
foreach (element_children($build) as $key) { foreach (Element::children($build) as $key) {
if (isset($build[$key]['#label_display']) && $build[$key]['#label_display'] == 'above') { if (isset($build[$key]['#label_display']) && $build[$key]['#label_display'] == 'above') {
$build[$key] += array('#prefix' => ''); $build[$key] += array('#prefix' => '');
$build[$key]['#prefix'] = $build[$key]['#title'] . ":\n"; $build[$key]['#prefix'] = $build[$key]['#title'] . ":\n";
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Core\Render\Element;
use Drupal\field\Field as FieldService; use Drupal\field\Field as FieldService;
use Drupal\field\FieldInstanceConfigInterface; use Drupal\field\FieldInstanceConfigInterface;
...@@ -157,8 +158,8 @@ function _content_translation_preprocess_language_content_settings_table(&$varia ...@@ -157,8 +158,8 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
array_unshift($build['#header'], array('data' => t('Translatable'), 'class' => array('translatable'))); array_unshift($build['#header'], array('data' => t('Translatable'), 'class' => array('translatable')));
$rows = array(); $rows = array();
foreach (element_children($element) as $bundle) { foreach (Element::children($element) as $bundle) {
$field_names = !empty($element[$bundle]['fields']) ? element_children($element[$bundle]['fields']) : array(); $field_names = !empty($element[$bundle]['fields']) ? Element::children($element[$bundle]['fields']) : array();
if (!empty($element[$bundle]['translatable'])) { if (!empty($element[$bundle]['translatable'])) {
$checkbox_id = $element[$bundle]['translatable']['#id']; $checkbox_id = $element[$bundle]['translatable']['#id'];
} }
...@@ -213,7 +214,7 @@ function _content_translation_preprocess_language_content_settings_table(&$varia ...@@ -213,7 +214,7 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
if (!empty($element[$bundle]['columns'][$field_name])) { if (!empty($element[$bundle]['columns'][$field_name])) {
$column_element = &$element[$bundle]['columns'][$field_name]; $column_element = &$element[$bundle]['columns'][$field_name];
foreach (element_children($column_element) as $key) { foreach (Element::children($column_element) as $key) {
$column_label = $column_element[$key]['#title']; $column_label = $column_element[$key]['#title'];
unset($column_element[$key]['#title']); unset($column_element[$key]['#title']);
$rows[] = array( $rows[] = array(
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Core\Render\Element;
/** /**
* Base class for content translation controllers. * Base class for content translation controllers.
...@@ -292,7 +293,7 @@ public function entityFormSharedElements($element, $form_state, $form) { ...@@ -292,7 +293,7 @@ public function entityFormSharedElements($element, $form_state, $form) {
$ignored_types = array_flip(array('actions', 'value', 'hidden', 'vertical_tabs', 'token', 'details')); $ignored_types = array_flip(array('actions', 'value', 'hidden', 'vertical_tabs', 'token', 'details'));
} }
foreach (element_children($element) as $key) { foreach (Element::children($element) as $key) {
if (!isset($element[$key]['#type'])) { if (!isset($element[$key]['#type'])) {
$this->entityFormSharedElements($element[$key], $form_state, $form); $this->entityFormSharedElements($element[$key], $form_state, $form);
} }
...@@ -345,7 +346,7 @@ protected function addTranslatabilityClue(&$element) { ...@@ -345,7 +346,7 @@ protected function addTranslatabilityClue(&$element) {
$element['#title'] .= $suffix; $element['#title'] .= $suffix;
} }
// If the current element does not have a (valid) title, try child elements. // If the current element does not have a (valid) title, try child elements.
elseif ($children = element_children($element)) { elseif ($children = Element::children($element)) {
foreach ($children as $delta) { foreach ($children as $delta) {
$this->addTranslatabilityClue($element[$delta], $suffix); $this->addTranslatabilityClue($element[$delta], $suffix);
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
use Drupal\Core\Entity\EntityChangedInterface; use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormBase;
use Drupal\Core\Render\Element;
use Drupal\entity\Entity\EntityFormDisplay; use Drupal\entity\Entity\EntityFormDisplay;
use Drupal\user\TempStoreFactory; use Drupal\user\TempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -214,7 +215,7 @@ protected function simplify(array &$form, array &$form_state) { ...@@ -214,7 +215,7 @@ protected function simplify(array &$form, array &$form_state) {
// with per-delta elements. Skip single checkboxes, because their title is // with per-delta elements. Skip single checkboxes, because their title is
// key to their UI. Also skip widgets with multiple subelements, because in // key to their UI. Also skip widgets with multiple subelements, because in
// that case, per-element labeling is informative. // that case, per-element labeling is informative.
$num_children = count(element_children($widget_element)); $num_children = count(Element::children($widget_element));
if ($num_children == 0 && $widget_element['#type'] != 'checkbox') { if ($num_children == 0 && $widget_element['#type'] != 'checkbox') {
$widget_element['#title_display'] = 'invisible'; $widget_element['#title_display'] = 'invisible';
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Html;
use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Render\Element;
use Drupal\editor\Entity\Editor; use Drupal\editor\Entity\Editor;
use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
...@@ -76,7 +77,7 @@ function editor_form_filter_admin_overview_alter(&$form, $form_state) { ...@@ -76,7 +77,7 @@ function editor_form_filter_admin_overview_alter(&$form, $form_state) {
// Then splice in the name of each text editor for each text format. // Then splice in the name of each text editor for each text format.
$editors = \Drupal::service('plugin.manager.editor')->getDefinitions(); $editors = \Drupal::service('plugin.manager.editor')->getDefinitions();
foreach (element_children($form['formats']) as $format_id) { foreach (Element::children($form['formats']) as $format_id) {
$editor = editor_load($format_id); $editor = editor_load($format_id);
$editor_name = ($editor && isset($editors[$editor->editor])) ? $editors[$editor->editor]['label'] : drupal_placeholder('—'); $editor_name = ($editor && isset($editors[$editor->editor])) ? $editors[$editor->editor]['label'] : drupal_placeholder('—');
$editor_column['editor'] = array('#markup' => $editor_name); $editor_column['editor'] = array('#markup' => $editor_name);
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\Core\Database\Query\AlterableInterface; use Drupal\Core\Database\Query\AlterableInterface;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Render\Element;
use Drupal\field\FieldConfigInterface; use Drupal\field\FieldConfigInterface;
/** /**
...@@ -118,7 +119,7 @@ function _entity_reference_field_instance_settings_ajax_process_element(&$elemen ...@@ -118,7 +119,7 @@ function _entity_reference_field_instance_settings_ajax_process_element(&$elemen
); );
} }
foreach (element_children($element) as $key) { foreach (Element::children($element) as $key) {
_entity_reference_field_instance_settings_ajax_process_element($element[$key], $main_form);