diff --git a/core/modules/field_ui/field_ui.admin.inc b/core/modules/field_ui/field_ui.admin.inc deleted file mode 100644 index 624f1245819ffa2bce18072dbad201c9d0ae27a3..0000000000000000000000000000000000000000 --- a/core/modules/field_ui/field_ui.admin.inc +++ /dev/null @@ -1,87 +0,0 @@ -<?php - -/** - * @file - * Administrative interface for custom field type creation. - */ - -/** - * Returns HTML for Field UI overview tables. - * - * @param $variables - * An associative array containing: - * - elements: An associative array containing a Form API structure to be - * rendered as a table. - * - * @ingroup themeable - */ -function theme_field_ui_table($variables) { - $elements = $variables['elements']; - $table = array(); - - // Add table headers and attributes. - foreach (array('header', 'attributes') as $key) { - if (isset($elements["#$key"])) { - $table[$key] = $elements["#$key"]; - } - } - - // Determine the colspan to use for region rows, by checking the number of - // columns in the headers. - $columns_count = 0; - foreach ($table['header'] as $header) { - $columns_count += (is_array($header) && isset($header['colspan']) ? $header['colspan'] : 1); - } - - // Render rows, region by region. - foreach ($elements['#regions'] as $region_name => $region) { - $region_name_class = drupal_html_class($region_name); - - // Add region rows. - if (isset($region['title']) && empty($region['invisible'])) { - $table['rows'][] = array( - 'class' => array('region-title', 'region-' . $region_name_class . '-title'), - 'no_striping' => TRUE, - 'data' => array( - array('data' => $region['title'], 'colspan' => $columns_count), - ), - ); - } - if (isset($region['message'])) { - $class = (empty($region['rows_order']) ? 'region-empty' : 'region-populated'); - $table['rows'][] = array( - 'class' => array('region-message', 'region-' . $region_name_class . '-message', $class), - 'no_striping' => TRUE, - 'data' => array( - array('data' => $region['message'], 'colspan' => $columns_count), - ), - ); - } - - // Add form rows, in the order determined at pre-render time. - foreach ($region['rows_order'] as $name) { - $element = $elements[$name]; - - $row = array('data' => array()); - if (isset($element['#attributes'])) { - $row += $element['#attributes']; - } - - // Render children as table cells. - 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')) { - $cell = array('data' => drupal_render($child)); - if (isset($child['#cell_attributes'])) { - $cell += $child['#cell_attributes']; - } - $row['data'][] = $cell; - } - } - $table['rows'][] = $row; - } - } - - return theme('table', $table); -} diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index 17e8ad0b134157e014dc16a29f3799cb79b75802..9c695975ef68bfeb7b510a0111bf8d2ddc00b969 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -214,7 +214,6 @@ function field_ui_theme() { return array( 'field_ui_table' => array( 'render element' => 'elements', - 'file' => 'field_ui.admin.inc', ), ); } @@ -324,3 +323,85 @@ function field_ui_view_mode_presave(EntityViewModeInterface $view_mode) { function field_ui_view_mode_delete(EntityViewModeInterface $view_mode) { Drupal::state()->set('menu_rebuild_needed', TRUE); } + +/** + * Returns HTML for Field UI overview tables. + * + * @param $variables + * An associative array containing: + * - elements: An associative array containing a Form API structure to be + * rendered as a table. + * + * @ingroup themeable + */ +function theme_field_ui_table($variables) { + $elements = $variables['elements']; + $table = array(); + + // Add table headers and attributes. + foreach (array('header', 'attributes') as $key) { + if (isset($elements["#$key"])) { + $table[$key] = $elements["#$key"]; + } + } + + // Determine the colspan to use for region rows, by checking the number of + // columns in the headers. + $columns_count = 0; + foreach ($table['header'] as $header) { + $columns_count += (is_array($header) && isset($header['colspan']) ? $header['colspan'] : 1); + } + + // Render rows, region by region. + foreach ($elements['#regions'] as $region_name => $region) { + $region_name_class = drupal_html_class($region_name); + + // Add region rows. + if (isset($region['title']) && empty($region['invisible'])) { + $table['rows'][] = array( + 'class' => array('region-title', 'region-' . $region_name_class . '-title'), + 'no_striping' => TRUE, + 'data' => array( + array('data' => $region['title'], 'colspan' => $columns_count), + ), + ); + } + if (isset($region['message'])) { + $class = (empty($region['rows_order']) ? 'region-empty' : 'region-populated'); + $table['rows'][] = array( + 'class' => array('region-message', 'region-' . $region_name_class . '-message', $class), + 'no_striping' => TRUE, + 'data' => array( + array('data' => $region['message'], 'colspan' => $columns_count), + ), + ); + } + + // Add form rows, in the order determined at pre-render time. + foreach ($region['rows_order'] as $name) { + $element = $elements[$name]; + + $row = array('data' => array()); + if (isset($element['#attributes'])) { + $row += $element['#attributes']; + } + + // Render children as table cells. + 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')) { + $cell = array('data' => drupal_render($child)); + if (isset($child['#cell_attributes'])) { + $cell += $child['#cell_attributes']; + } + $row['data'][] = $cell; + } + } + $table['rows'][] = $row; + } + } + + return theme('table', $table); +} +