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 @@
* Helper functions and form handlers used for the authorize.php script.
*/
use Drupal\Core\Render\Element;
/**
* Form constructor for the file transfer authorization form.
*
......@@ -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
// processing, pass in that subarray to the recursive call. Otherwise, just
// 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));
}
}
......
......@@ -3318,7 +3318,7 @@ function drupal_pre_render_link($element) {
*/
function drupal_pre_render_links($element) {
$element += array('#links' => array(), '#attached' => array());
foreach (element_children($element) as $key) {
foreach (Element::children($element) as $key) {
$child = &$element[$key];
// 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.
......@@ -3493,9 +3493,10 @@ function drupal_render_page($page) {
* #pre_render functions have been called, #printed is checked a second time
* in case a #pre_render function flags the element as printed.
* - The child elements of this element are sorted by weight using uasort() in
* element_children(). Since this is expensive, when passing already sorted
* elements to drupal_render(), for example from a database query, set
* $elements['#sorted'] = TRUE to avoid sorting them a second time.
* \Drupal\Core\Render\Element::children(). Since this is expensive, when
* passing already sorted elements to drupal_render(), for example from a
* 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:
* - If this element has #theme defined and #theme is an implemented theme
* hook/suggestion then _theme() is called and must render both the element
......@@ -3777,7 +3778,8 @@ function drupal_render(&$elements, $is_recursive_call = FALSE) {
* The structured array whose children shall be rendered.
* @param array $children_keys
* (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
* The rendered HTML of all children of the element.
......@@ -3786,7 +3788,7 @@ function drupal_render(&$elements, $is_recursive_call = FALSE) {
*/
function drupal_render_children(&$element, $children_keys = NULL) {
if ($children_keys === NULL) {
$children_keys = element_children($element);
$children_keys = Element::children($element);
}
$output = '';
foreach ($children_keys as $key) {
......@@ -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
// we've already collected them above by retrieving this element (and its
// 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) {
$callbacks = drupal_render_collect_post_render_cache($elements[$child], $callbacks, FALSE);
}
......@@ -4186,7 +4188,7 @@ function drupal_render_collect_attached($elements, $return = FALSE) {
if (isset($elements['#attached'])) {
$attached = drupal_merge_attached($attached, $elements['#attached']);
}
if ($children = element_children($elements)) {
if ($children = Element::children($elements)) {
foreach ($children as $child) {
drupal_render_collect_attached($elements[$child]);
}
......@@ -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) {
$tags = drupal_render_collect_cache_tags($element[$child], $tags);
}
......
This diff is collapsed.
......@@ -8,6 +8,7 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\Language;
use Drupal\Core\Render\Element;
use Drupal\Core\Template\Attribute;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
......@@ -553,7 +554,7 @@ function menu_local_tasks($level = 0) {
function menu_primary_local_tasks() {
$links = menu_local_tasks(0);
// 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() {
function menu_secondary_local_tasks() {
$links = menu_local_tasks(1);
// 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) {
* @see drupal_attach_tabledrag()
*/
function drupal_pre_render_table(array $element) {
foreach (element_children($element) as $first) {
foreach (Element::children($element) as $first) {
$row = array('data' => array());
// Apply attributes of first-level elements as table row attributes.
if (isset($element[$first]['#attributes'])) {
......@@ -1332,7 +1332,7 @@ function drupal_pre_render_table(array $element) {
// Turn second-level elements into table row columns.
// @todo Do not render a cell for children of #type 'value'.
// @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
// original element are taken over.
$column = array('data' => &$element[$first][$second]);
......@@ -1349,7 +1349,7 @@ function drupal_pre_render_table(array $element) {
}
// 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.
......@@ -1682,8 +1682,9 @@ function template_preprocess_item_list(&$variables) {
// child elements of the nested list, instead of #items. For
// convenience, we automatically move them into #items.
if (!isset($child['#items'])) {
// This is the same condition as in element_children(), which cannot
// be used here, since it triggers an error on string values.
// This is the same condition as in
// \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) {
if ($child_key[0] !== '#') {
$child['#items'][$child_key] = $child_value;
......@@ -2405,9 +2406,9 @@ function template_preprocess_field(&$variables, $hook) {
// We want other preprocess functions and the theme implementation to have
// fast access to the field item render arrays. The item render array keys
// (deltas) should always be numerically indexed starting from 0, and looping
// on those keys is faster than calling element_children() or looping on all
// keys within $element, since that requires traversal of all element
// properties.
// on those keys is faster than calling
// \Drupal\Core\Render\Element::children() or looping on all keys within
// $element, since that requires traversal of all element properties.
$variables['items'] = array();
$delta = 0;
while (!empty($element[$delta])) {
......
......@@ -39,7 +39,7 @@ public static function sortByWeightElement(array $a, array $b) {
/**
* 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
* First item for comparison. The compared items should be associative
......
......@@ -9,6 +9,7 @@
use Drupal\Core\Form\FormBase;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Render\Element;
/**
* Base class for entity form controllers.
......@@ -186,7 +187,7 @@ protected function actionsElement(array $form, array &$form_state) {
}
$count = 0;
foreach (element_children($element) as $action) {
foreach (Element::children($element) as $action) {
$element[$action] += array(
'#type' => 'submit',
'#weight' => ++$count * 5,
......
......@@ -95,7 +95,7 @@ public static function children(array &$elements, $sort = FALSE) {
uasort($children, 'Drupal\Component\Utility\SortArray::sortByWeightProperty');
// Put the sorted children back into $elements in the correct order, to
// preserve sorting if the same element is passed through
// element_children() twice.
// \Drupal\Core\Render\Element::children() twice.
foreach ($children as $key => $child) {
unset($elements[$key]);
$elements[$key] = $child;
......
......@@ -6,6 +6,7 @@
*/
use Drupal\Component\Utility\String;
use Drupal\Core\Render\Element;
/**
* Prepares variables for aggregator item templates.
......@@ -86,7 +87,7 @@ function theme_aggregator_page_opml($variables) {
function template_preprocess_aggregator_summary_items(&$variables) {
$variables['title'] = String::checkPlain($variables['source']->label());
$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];
}
$variables['summary_list'] = array(
......
......@@ -5,6 +5,8 @@
* Administration page callbacks for the Book module.
*/
use Drupal\Core\Render\Element;
/**
* Returns HTML for a book administration form.
*
......@@ -23,7 +25,7 @@ function theme_book_admin_table($variables) {
$rows = array();
$destination = drupal_get_destination();
$access = \Drupal::currentUser()->hasPermission('administer nodes');
foreach (element_children($form) as $key) {
foreach (Element::children($form) as $key) {
$nid = $form[$key]['nid']['#value'];
$href = \Drupal::url('node.view', array('node' => $nid));
......
......@@ -8,6 +8,7 @@
use Drupal\book\BookManagerInterface;
use Drupal\Component\Utility\String;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Render\Element;
use Drupal\node\NodeInterface;
use Drupal\node\NodeTypeInterface;
use Drupal\Core\Language\Language;
......@@ -384,7 +385,7 @@ function template_preprocess_book_all_books_block(&$variables) {
// Remove all non-renderable elements.
$elements = $variables['book_menus'];
$variables['book_menus'] = array();
foreach (element_children($elements) as $index) {
foreach (Element::children($elements) as $index) {
$variables['book_menus'][$index] = $elements[$index];
}
}
......
......@@ -11,6 +11,7 @@
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Render\Element;
use Drupal\node\NodeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -97,7 +98,7 @@ public function submitForm(array &$form, array &$form_state) {
$order = array_flip(array_keys($form_state['input']['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']) {
$row = $form['table'][$key];
$values = $form_state['values']['table'][$key];
......
......@@ -12,6 +12,7 @@
use Drupal\ckeditor\CKEditorPluginManager;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Render\Element;
use Drupal\editor\Plugin\EditorBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\editor\Entity\Editor as EditorEntity;
......@@ -165,7 +166,7 @@ public function settingsForm(array $form, array &$form_state, EditorEntity $edit
),
);
$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['plugin_settings']);
}
......
......@@ -14,6 +14,7 @@
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Url;
use Drupal\field\FieldInstanceConfigInterface;
use Drupal\field\FieldConfigInterface;
......@@ -1387,7 +1388,7 @@ function template_preprocess_comment(&$variables) {
}
// 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];
}
......
......@@ -10,6 +10,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder;
use Drupal\Component\Utility\String;
use Drupal\Core\Render\Element;
/**
* Render controller for contact messages.
......@@ -44,7 +45,7 @@ public function view(EntityInterface $entity, $view_mode = 'full', $langcode = N
if ($view_mode == 'mail') {
// Convert field labels into headings.
// @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') {
$build[$key] += array('#prefix' => '');
$build[$key]['#prefix'] = $build[$key]['#title'] . ":\n";
......
......@@ -8,6 +8,7 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Render\Element;
use Drupal\field\Field as FieldService;
use Drupal\field\FieldInstanceConfigInterface;
......@@ -157,8 +158,8 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
array_unshift($build['#header'], array('data' => t('Translatable'), 'class' => array('translatable')));
$rows = array();
foreach (element_children($element) as $bundle) {
$field_names = !empty($element[$bundle]['fields']) ? element_children($element[$bundle]['fields']) : array();
foreach (Element::children($element) as $bundle) {
$field_names = !empty($element[$bundle]['fields']) ? Element::children($element[$bundle]['fields']) : array();
if (!empty($element[$bundle]['translatable'])) {
$checkbox_id = $element[$bundle]['translatable']['#id'];
}
......@@ -213,7 +214,7 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
if (!empty($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'];
unset($column_element[$key]['#title']);
$rows[] = array(
......
......@@ -10,6 +10,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Render\Element;
/**
* Base class for content translation controllers.
......@@ -292,7 +293,7 @@ public function entityFormSharedElements($element, $form_state, $form) {
$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'])) {
$this->entityFormSharedElements($element[$key], $form_state, $form);
}
......@@ -345,7 +346,7 @@ protected function addTranslatabilityClue(&$element) {
$element['#title'] .= $suffix;
}
// 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) {
$this->addTranslatabilityClue($element[$delta], $suffix);
}
......
......@@ -13,6 +13,7 @@
use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Render\Element;
use Drupal\entity\Entity\EntityFormDisplay;
use Drupal\user\TempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -214,7 +215,7 @@ protected function simplify(array &$form, array &$form_state) {
// with per-delta elements. Skip single checkboxes, because their title is
// key to their UI. Also skip widgets with multiple subelements, because in
// 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') {
$widget_element['#title_display'] = 'invisible';
}
......
......@@ -7,6 +7,7 @@
use Drupal\Component\Utility\Html;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Render\Element;
use Drupal\editor\Entity\Editor;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\EntityInterface;
......@@ -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.
$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_name = ($editor && isset($editors[$editor->editor])) ? $editors[$editor->editor]['label'] : drupal_placeholder('—');
$editor_column['editor'] = array('#markup' => $editor_name);
......
......@@ -9,6 +9,7 @@
use Drupal\Core\Database\Query\AlterableInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Render\Element;
use Drupal\field\FieldConfigInterface;
/**
......@@ -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);
}
}
......
......@@ -10,6 +10,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Render\Element;
use Drupal\field\Field as FieldHelper;
use Drupal\Core\Entity\ContentEntityDatabaseStorage;
use Drupal\Core\Field\FieldDefinitionInterface;
......@@ -692,7 +693,7 @@ public function getItems($values) {
return array(array('rendered' => drupal_render($render_array)));
}
foreach (element_children($render_array) as $count) {
foreach (Element::children($render_array) as $count) {
$items[$count]['rendered'] = $render_array[$count];
// FieldItemListInterface::view() adds an #access property to the render
// array that determines whether or not the current user is allowed to
......
......@@ -6,6 +6,7 @@
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Render\Element;
use Drupal\entity\EntityViewModeInterface;
use Drupal\field_ui\FieldUI;
use Drupal\field_ui\Plugin\Derivative\FieldUiLocalTask;
......@@ -274,7 +275,7 @@ function theme_field_ui_table($variables) {
}
// Render children as table cells.
foreach (element_children($element) as $cell_key) {
foreach (Element::children($element) as $cell_key) {
$child = &$element[$cell_key];
// Do not render a cell for children of #type 'value'.
if (!(isset($child['#type']) && $child['#type'] == 'value')) {
......
......@@ -10,6 +10,7 @@
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Field\FieldTypePluginManagerInterface;
use Drupal\Core\Render\Element;
use Drupal\field_ui\OverviewBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\field\Entity\FieldConfig;
......@@ -289,7 +290,7 @@ public function buildForm(array $form, array &$form_state, $entity_type_id = NUL
// here instead of a #pre_render callback because this form doesn't have the
// tabledrag behavior anymore.
$table['#regions']['content']['rows_order'] = array();
foreach (element_children($table) as $name) {
foreach (Element::children($table) as $name) {
$table['#regions']['content']['rows_order'][] = $name;
}
......
......@@ -184,7 +184,7 @@ public function tablePreRender($elements) {
// Add tabledrag indentation to the first row cell.
if ($depth = count($parents[$name])) {
$children = element_children($row);
$children = Element::children($row);
$cell = current($children);
$indentation = array(
'#theme' => 'indentation',
......
......@@ -6,6 +6,7 @@
*/
use Drupal\Component\Utility\Html;
use Drupal\Core\Render\Element;
use Drupal\field\FieldConfigInterface;
/**
......@@ -65,7 +66,7 @@ function theme_file_widget_multiple($variables) {
// Get our list of widgets in order (needed when the form comes back after
// preview or failed validation).
$widgets = array();
foreach (element_children($element) as $key) {
foreach (Element::children($element) as $key) {
$widgets[] = &$element[$key];
}
usort($widgets, '_field_sort_items_value_helper');
......@@ -82,7 +83,7 @@ function theme_file_widget_multiple($variables) {
// Delay rendering of the buttons, so that they can be rendered later in the
// "operations" column.
$operations_elements = array();
foreach (element_children($widget) as $sub_key) {
foreach (Element::children($widget) as $sub_key) {
if (isset($widget[$sub_key]['#type']) && $widget[$sub_key]['#type'] == 'submit') {
hide($widget[$sub_key]);
$operations_elements[] = &$widget[$sub_key];
......
......@@ -5,6 +5,7 @@
* Defines a "managed_file" Form API field and a "file" field for Field module.
*/
use Drupal\Core\Render\Element;
use Drupal\file\Entity\File;
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\Unicode;
......@@ -1413,7 +1414,7 @@ function file_managed_file_submit($form, &$form_state) {
// Get files that will be removed.
if ($element['#multiple']) {
$remove_fids = array();
foreach (element_children($element) as $name) {
foreach (Element::children($element) as $name) {
if (strpos($name, 'file_') === 0 && $element[$name]['selected']['#value']) {
$remove_fids[] = (int) substr($name, 5);
}
......
......@@ -11,6 +11,7 @@
use Drupal\Core\Field\WidgetBase;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Render\Element;
use Drupal\field\Field;
/**
......@@ -308,7 +309,7 @@ public static function validateMultipleCount($element, &$form_state, $form) {
$values = NestedArray::getValue($form_state['values'], $parents);
array_pop($parents);
$current = count(element_children(NestedArray::getValue($form, $parents))) - 1;
$current = count(Element::children(NestedArray::getValue($form, $parents))) - 1;
$field = Field::fieldInfo()->getField($element['#entity_type'], $element['#field_name']);
$uploaded = count($values['fids']);
......@@ -384,7 +385,7 @@ public static function process($element, &$form_state, $form) {
);
$field_element = NestedArray::getValue($form, $parents);
$new_wrapper = $field_element['#id'] . '-ajax-wrapper';
foreach (element_children($element) as $key) {
foreach (Element::children($element) as $key) {
if (isset($element[$key]['#ajax'])) {
$element[$key]['#ajax']['path'] = $new_path;
$element[$key]['#ajax']['options'] = $new_options;
......@@ -416,7 +417,7 @@ public static function process($element, &$form_state, $form) {
* method.
*/
public static function processMultiple($element, &$form_state, $form) {
$element_children = element_children($element, TRUE);
$element_children = Element::children($element, TRUE);
$count = count($element_children);
foreach ($element_children as $delta => $key) {
......
......@@ -9,6 +9,7 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\Language;
use Drupal\Core\Render\Element;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Template\Attribute;
use Drupal\filter\FilterFormatInterface;
......@@ -471,7 +472,7 @@ function filter_process_format($element) {
);
// Move this element into sub-element 'value'.
unset($element['value']);
foreach (element_properties($element) as $key) {
foreach (Element::properties($element) as $key) {
if (!in_array($key, $blacklist)) {
$element['value'][$key] = $element[$key];
}
......@@ -576,7 +577,7 @@ function filter_process_format($element) {
// Hide the text format selector and any other child element (such as text
// field's summary).
foreach (element_children($element) as $key) {
foreach (Element::children($element) as $key) {
if ($key != 'value') {
$element[$key]['#access'] = FALSE;
}
......
......@@ -8,6 +8,7 @@
namespace Drupal\forum\Form;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Render\Element;
use Drupal\taxonomy\Form\OverviewTerms;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
......@@ -70,7 +71,7 @@ public function buildForm(array $form, array &$form_state) {
// Build base taxonomy term overview.
$form = parent::buildForm($form, $form_state, $vocabulary);
foreach (element_children($form['terms']) as $key) {
foreach (Element::children($form['terms']) as $key) {
if (isset($form['terms'][$key]['#term'])) {
$term = $form['terms'][$key]['#term'];
$form['terms'][$key]['term']['#href'] = 'forum/' . $term->id();
......
......@@ -5,6 +5,7 @@
* Administration pages for image settings.
*/
use Drupal\Component\Utility\String;
use Drupal\Core\Render\Element;
/**
* Returns HTML for a listing of the effects within a specific image style.
*
......@@ -18,7 +19,7 @@ function theme_image_style_effects($variables) {
$form = $variables['form'];
$rows = array();
foreach (element_children($form) as $key) {
foreach (Element::children($form) as $key) {
$row = array();
$form[$key]['weight']['#attributes']['class'] = array('image-effect-order-weight');
if ($key != 'new') {
......@@ -181,7 +182,7 @@ function theme_image_anchor($variables) {
$rows = array();
$row = array();
foreach (element_children($element) as $n => $key) {
foreach (Element::children($element) as $n => $key) {
$element[$key]['#attributes']['title'] = $element[$key]['#title'];
unset($element[$key]['#title']);
$row[] = drupal_render($element[$key]);
......
......@@ -7,6 +7,7 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Render\Element;
/**
* Prepare a language code list for unused predefined languages.
......@@ -45,7 +46,7 @@ function theme_language_negotiation_configure_form($variables) {
foreach ($form[$type]['title'] as $id => $element) {
// Do not take form control structures.
if (is_array($element) && element_child($id)) {
if (is_array($element) && Element::child($id)) {
$row = array(
'data' => array(
'<strong>' . drupal_render($form[$type]['title'][$id]) . '</strong>',
......@@ -111,7 +112,7 @@ function theme_language_negotiation_configure_form($variables) {
function theme_language_negotiation_configure_browser_form_table($variables) {
$form = $variables['form'];
$rows = array();
foreach (element_children($form, TRUE) as $key) {
foreach (Element::children($form, TRUE) as $key) {
$row = array();
$row[] = drupal_render($form[$key]['browser_langcode']);
$row[] = drupal_render($form[$key]['drupal_langcode']);
......@@ -268,7 +269,7 @@ function template_preprocess_language_content_settings_table(&$variables) {
);
$rows = array();
foreach (element_children($element) as $bundle) {
foreach (Element::children($element) as $bundle) {
$rows[$bundle] = array(
'data' => array(
array(
......
......@@ -8,6 +8,7 @@
namespace Drupal\locale\Form;
use Drupal\Component\Utility\String;
use Drupal\Core\Render\Element;
use Drupal\locale\SourceString;
/**
......@@ -143,7 +144,7 @@ public function buildForm(array $form, array &$form_state) {
}
}
}
if (count(element_children($form['strings']))) {
if (count(Element::children($form['strings']))) {
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
......
......@@ -7,6 +7,7 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Language\Language;
use Drupal\Core\Render\Element;
use Drupal\locale\SourceString;
use Drupal\locale\TranslationString;
use Symfony\Component\HttpFoundation\RedirectResponse;
......@@ -282,7 +283,7 @@ function theme_locale_translate_edit_form_strings($variables) {
t('Translation for @language', array('@language' => $form['#language'])),
);