From a24e15b9ec82ecacef1a4ad4374187abddbf404b Mon Sep 17 00:00:00 2001 From: Alex Barth <alex_b@53995.no-reply.drupal.org> Date: Fri, 17 Sep 2010 22:46:26 +0000 Subject: [PATCH] Upgrade all calls to theme(), upgrade feeds_ui_theme(). --- feeds.pages.inc | 33 +++++++++++++++++---------------- feeds_ui/feeds_ui.admin.inc | 25 ++++++++++++++++--------- feeds_ui/feeds_ui.module | 4 ++++ plugins/FeedsCSVParser.inc | 4 ++-- 4 files changed, 39 insertions(+), 27 deletions(-) diff --git a/feeds.pages.inc b/feeds.pages.inc index 8baac4ed..525651c2 100644 --- a/feeds.pages.inc +++ b/feeds.pages.inc @@ -156,25 +156,26 @@ function feeds_fetcher_callback($importer, $feed_nid = 0) { function theme_feeds_upload($element) { drupal_add_css(drupal_get_path('module', 'feeds') .'/feeds.css'); _form_set_class($element, array('form-file')); - $output = ''; + $description = ''; if (!empty($element['#file_info'])) { $info = $element['#file_info']; - $output .= '<div class="file-info">'; - $output .= '<div class="file-name">'; - $output .= l(basename($info['path']), $info['path']); - $output .= '</div>'; - $output .= '<div class="file-size">'; - $output .= format_size($info['size']); - $output .= '</div>'; + $description .= '<div class="file-info">'; + $description .= '<div class="file-name">'; + $description .= l(basename($info['path']), $info['path']); + $description .= '</div>'; + $description .= '<div class="file-size">'; + $description .= format_size($info['size']); + $description .= '</div>'; if (isset($info['mime'])) { - $output .= '<div class="file-mime">'; - $output .= check_plain($info['mime']); - $output .= '</div>'; + $description .= '<div class="file-mime">'; + $description .= check_plain($info['mime']); + $description .= '</div>'; } - $output .= '</div>'; + $description .= '</div>'; } - $output .= '<div class="file-upload">'; - $output .= '<input type="file" name="'. $element['#name'] .'"'. ($element['#attributes'] ? ' '. drupal_attributes($element['#attributes']) : '') .' id="'. $element['#id'] .'" size="'. $element['#size'] ."\" />\n"; - $output .= '</div>'; - return theme('form_element', $element, $output); + $description .= '<div class="file-upload">'; + $description .= '<input type="file" name="'. $element['#name'] .'"'. ($element['#attributes'] ? ' '. drupal_attributes($element['#attributes']) : '') .' id="'. $element['#id'] .'" size="'. $element['#size'] ."\" />\n"; + $description .= '</div>'; + $element['#description'] = $description; + return theme('form_element', $element); } diff --git a/feeds_ui/feeds_ui.admin.inc b/feeds_ui/feeds_ui.admin.inc index c7e773a8..50b47442 100644 --- a/feeds_ui/feeds_ui.admin.inc +++ b/feeds_ui/feeds_ui.admin.inc @@ -336,7 +336,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') { $info['title'] = t('Basic settings'); $info['body'] = array( array( - 'body' => theme('item_list', $items), + 'body' => theme('item_list', array('items' => $items)), 'actions' => array(l(t('Settings'), $path .'/settings')), ), ); @@ -394,7 +394,10 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') { $info['actions'] = array(l(t('Change'), $path .'/processor')); $config_info[] = $info; - return theme('feeds_ui_edit_page', $config_info, $active_container); + return theme('feeds_ui_edit_page', array( + 'info' => $config_info, + 'active' => $active_container, + )); } /** @@ -678,7 +681,9 @@ function theme_feeds_ui_overview_form($variables) { /** * Theme feeds_ui_edit_page(). */ -function theme_feeds_ui_edit_page($config_info, $active_container) { +function theme_feeds_ui_edit_page($variables) { + $config_info = $variables['info']; + $active_container = $variables['active']; drupal_add_css(drupal_get_path('module', 'feeds_ui') .'/feeds_ui.css'); // Outer wrapper. @@ -687,14 +692,14 @@ function theme_feeds_ui_edit_page($config_info, $active_container) { // Build left bar. $output .= '<div class="left-bar">'; foreach ($config_info as $info) { - $output .= theme('feeds_ui_container', $info); + $output .= theme('feeds_ui_container', array('container' => $info)); } $output .= '</div>'; // Build configuration space. $output .= '<div class="configuration">'; $output .= '<div class="configuration-squeeze">'; - $output .= theme('feeds_ui_container', $active_container); + $output .= theme('feeds_ui_container', array('container' => $active_container)); $output .= '</div>'; $output .= '</div>'; @@ -709,8 +714,9 @@ function theme_feeds_ui_edit_page($config_info, $active_container) { * * @todo Replace with theme_fieldset or a wrapper to theme_fieldset? * - * @param $container - * An array that describes the container. All elements are optional: + * @param $variables + * An array containing an array at 'container'. + * A 'container' array may contain one or more of the following keys: * array( * 'title' => 'the title', * 'body' => 'the body of the container, may also be an array of more @@ -719,7 +725,8 @@ function theme_feeds_ui_edit_page($config_info, $active_container) { * 'id' => 'the id of the container', * ); */ -function theme_feeds_ui_container($container) { +function theme_feeds_ui_container($variables) { + $container = $variables['container']; $class = empty($container['class']) ? array('plain') : $container['class']; $id = empty($container['id']) ? '': ' id="'. $container['id'] .'"'; @@ -743,7 +750,7 @@ function theme_feeds_ui_container($container) { $output .= '<div class="feeds-container-body">'; if (is_array($container['body'])) { foreach ($container['body'] as $c) { - $output .= theme('feeds_ui_container', $c); + $output .= theme('feeds_ui_container', array('container' => $c)); } } else { diff --git a/feeds_ui/feeds_ui.module b/feeds_ui/feeds_ui.module index 2fe47a5a..efb7e27b 100644 --- a/feeds_ui/feeds_ui.module +++ b/feeds_ui/feeds_ui.module @@ -92,15 +92,19 @@ function feeds_ui_theme() { 'file' => 'feeds_ui.admin.inc', ), 'feeds_ui_mapping_form' => array( + 'render element' => 'form', 'file' => 'feeds_ui.admin.inc', ), 'feeds_ui_edit_page' => array( + 'variables' => array('info' => NULL, 'active' => NULL), 'file' => 'feeds_ui.admin.inc', ), 'feeds_ui_plugin_form' => array( + 'render element' => 'form', 'file' => 'feeds_ui.admin.inc', ), 'feeds_ui_container' => array( + 'variables' => array('container' => NULL), 'file' => 'feeds_ui.admin.inc', ), ); diff --git a/plugins/FeedsCSVParser.inc b/plugins/FeedsCSVParser.inc index c6c2819b..691e1f15 100644 --- a/plugins/FeedsCSVParser.inc +++ b/plugins/FeedsCSVParser.inc @@ -33,7 +33,7 @@ class FeedsCSVParser extends FeedsParser { * Get first line and use it for column names, convert them to lower case. * Be aware that the $parser and iterator objects can be modified in this * function since they are passed in by reference - * + * * @param ParserCSV $parser * @param ParserCSVIterator $iterator * @return @@ -113,7 +113,7 @@ class FeedsCSVParser extends FeedsParser { t('Import !csv_files with one or more of these columns: !columns.', array('!csv_files' => l(t('CSV files'), 'http://en.wikipedia.org/wiki/Comma-separated_values'), '!columns' => implode(', ', $sources))), format_plural(count($uniques), t('Column <strong>!column</strong> is mandatory and considered unique: only one item per !column value will be created.', array('!column' => implode(', ', $uniques))), t('Columns <strong>!columns</strong> are mandatory and values in these columns are considered unique: only one entry per value in one of these column will be created.', array('!columns' => implode(', ', $uniques)))), ); - $form['help']['#value'] = '<div class="help">'. theme('item_list', $items) .'</div>'; + $form['help']['#value'] = '<div class="help">'. theme('item_list', array('items' => $items)) .'</div>'; $form['delimiter'] = array( '#type' => 'select', -- GitLab