/** * Renders form with a list of available database updates. */ function update_selection_page() { backdrop_set_title('Backdrop database update'); $elements = backdrop_get_form('update_script_selection_form'); $output = backdrop_render($elements); update_task_list('select'); return $output; }
/** * Implements theme_field__field_type(). */ function materialize_field__taxonomy_term_reference($variables) { $output = ''; // Render the label, if it's not hidden. if (!$variables['label_hidden']) { $output .= '<h3 class="field-label">' . $variables['label'] . ': </h3>'; } // Render the items. $output .= $variables['element']['#label_display'] == 'inline' ? '<ul class="links inline">' : '<ul class="links">'; foreach ($variables['items'] as $delta => $item) { $item_attributes = isset($variables['item_attributes'][$delta]) ? backdrop_attributes($variables['item_attributes'][$delta]) : ''; $output .= '<li class="taxonomy-term-reference-' . $delta . '"' . $item_attributes . '>' . backdrop_render($item) . '</li>'; } $output .= '</ul>'; // Render the surrounding DIV with appropriate classes and attributes. if (!in_array('clearfix', $variables['classes'])) { $variables['classes'][] = 'clearfix'; } $output = '<div class="' . implode(' ', $variables['classes']) . '"' . backdrop_attributes($variables['attributes']) . '>' . $output . '</div>'; return $output; }
/** * Alter replacement values for placeholder tokens. * * @param $replacements * An associative array of replacements returned by hook_tokens(). * @param $context * The context in which hook_tokens() was called. An associative array with * the following keys, which have the same meaning as the corresponding * parameters of hook_tokens(): * - 'type' * - 'tokens' * - 'data' * - 'options' * * @see hook_tokens() */ function hook_tokens_alter(array &$replacements, array $context) { $options = $context['options']; if (isset($options['language'])) { $url_options['language'] = $options['language']; $language_code = $options['language']->langcode; } else { $language_code = NULL; } $sanitize = !empty($options['sanitize']); if ($context['type'] == 'node' && !empty($context['data']['node'])) { $node = $context['data']['node']; // Alter the [node:title] token, and replace it with the rendered content // of a field (field_title). if (isset($context['tokens']['title'])) { $title = field_view_field('node', $node, 'field_title', 'default', $language_code); $replacements[$context['tokens']['title']] = backdrop_render($title); } } }
/** * Implements theme_preprocess_menu_link(). */ function teamwork_15_subtheme_menu_link(array $variables) { $element = $variables['element']; $classes = array('pure-menu-item'); $element['#attributes']['class'] = array_merge($element['#attributes']['class'], $classes); $sub_menu = ''; if ($element['#below']) { $sub_menu = backdrop_render($element['#below']); } $output = l($element['#title'], $element['#href'], $element['#localized_options']); return '<li' . backdrop_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n"; }
} if (!empty($results['page_message'])) { backdrop_set_message($results['page_message']['message'], $results['page_message']['type']); } $output = theme('authorize_report', array('messages' => $results['messages'])); $links = array(); if (is_array($results['tasks'])) { $links += $results['tasks']; } else { $links = array_merge($links, array(l(t('Administration pages'), 'admin'), l(t('Front page'), '<front>'))); } $output .= theme('item_list', array('items' => $links, 'title' => t('Next steps'))); } elseif (isset($_GET['batch'])) { $output = _batch_page(); } else { if (empty($_SESSION['authorize_operation']) || empty($_SESSION['authorize_filetransfer_info'])) { $output = t('It appears you have reached this page in error.'); } elseif (!($batch = batch_get())) { // We have a batch to process, show the filetransfer form. $elements = backdrop_get_form('authorize_filetransfer_form'); $output = backdrop_render($elements); } } // We defer the display of messages until all operations are done. $show_messages = !(($batch = batch_get()) && isset($batch['running'])); } else { $output = authorize_access_denied_page(); } if (!empty($output)) { print theme('update_page', array('content' => $output, 'show_messages' => $show_messages)); }
/** * Update the search index for this module. * * This hook is called every cron run if search.module is enabled, your * module has implemented hook_search_info(), and your module has been set as * an active search module on the Search settings page * (admin/config/search/settings). It allows your module to add items to the * built-in search index using search_index(), or to add them to your module's * own indexing mechanism. * * When implementing this hook, your module should index content items that * were modified or added since the last run. PHP has a time limit * for cron, though, so it is advisable to limit how many items you index * per run using config_get('search.settings', 'search_cron_limit') (see * example below). Also, since the cron run could time out and abort in the * middle of your run, you should update your module's internal bookkeeping on * when items have last been indexed as you go rather than waiting to the end * of indexing. * * @ingroup search */ function hook_update_index() { $limit = (int) config_get('search.settings', 'search_cron_limit'); $result = db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid ASC", 0, $limit); foreach ($result as $node) { $node = node_load($node->nid); // Save the changed time of the most recent indexed node, for the search // results half-life calculation. state_set('node_cron_last', $node->changed); // Render the node. node_build_content($node, 'search_index'); $node->rendered = backdrop_render($node->content); $text = '<h1>' . check_plain($node->title) . '</h1>' . $node->rendered; // Fetch extra data normally not visible $extra = module_invoke_all('node_update_index', $node); foreach ($extra as $t) { $text .= $t; } // Update index search_index($node->nid, 'node', $text); } }
?> <div class="attachment attachment-before"> <?php print $attachment_before; ?> </div> <?php } ?> <?php if ($rows) { ?> <div class="view-content"> <?php print is_array($rows) ? backdrop_render($rows) : $rows; ?> </div> <?php } elseif ($empty) { ?> <div class="view-empty"> <?php print $empty; ?> </div> <?php } ?> <?php
/** * Overrides theme_menu_link(). */ function borg_menu_link(array $variables) { $element = $variables['element']; $sub_menu = ''; if ($element['#below']) { $sub_menu = backdrop_render($element['#below']); } $menu_name = isset($element['#original_link']['menu_name']) ? $element['#original_link']['menu_name'] : NULL; if ($menu_name === 'main-menu' || $menu_name === 'menu-handbook') { // Add the font awesome icon. if ($element['#href']) { $element['#title'] .= ' <i class="fa fa-forward fa-fw"></i>'; $element['#localized_options']['html'] = TRUE; } // If this is the handbook link and we're on a book page, set an active class. if ($element['#href'] === 'node/1') { $node = menu_get_object(); if (isset($node) && isset($node->type) && $node->type === 'book') { $element['#attributes']['class'][] = 'active'; } } } $output = l($element['#title'], $element['#href'], $element['#localized_options']); return '<li' . backdrop_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n"; }
function afterlight_tribute_menu_link(array $variables) { $element = $variables['element']; $sub_menu = ''; if ($element['#below']) { $sub_menu = backdrop_render($element['#below']); } $output = l($element['#title'], $element['#href'], $element['#localized_options']); return '<li' . backdrop_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n"; }
* - $nid: The node ID of the Webform. * * The $form array contains two main pieces: * - $form['submitted']: The main content of the user-created form. * - $form['details']: Internal information stored by Webform. * * If a preview is enabled, these keys will be available on the preview page: * - $form['preview_message']: The preview message renderable. * - $form['preview']: A renderable representing the entire submission preview. */ // Print out the progress bar at the top of the page print backdrop_render($form['progressbar']); // Print out the preview message if on the preview page. if (isset($form['preview_message'])) { print '<div class="messages warning">'; print backdrop_render($form['preview_message']); print '</div>'; } $will_you_be_attending_options = backdrop_render($form['submitted']['will_you_be_attending']['yes']) . backdrop_render($form['submitted']['will_you_be_attending']['no']); $will_you_be_attending_label = preg_replace("/<\\/div>/", "", backdrop_render($form['submitted']['will_you_be_attending'])); $will_you_be_attending = $will_you_be_attending_label . $will_you_be_attending_options . '</div>'; // Print out the main part of the form. // Feel free to break this up and move the pieces within the array. print $will_you_be_attending; print backdrop_render($form['submitted']['name']); print backdrop_render($form['submitted']['email_address']); print backdrop_render($form['submitted']['additional_people']); print backdrop_render($form['submitted']); // Always print out the entire $form. This renders the remaining pieces of the // form that haven't yet been rendered above (buttons, hidden elements, etc). print backdrop_render_children($form);
<?php /** * @file * Output the main layout content editor form. */ $actions = backdrop_render($form['actions']); $content = backdrop_render($form['content']); ?> <div id="layout-edit"> <div class="layout-settings"> <?php print backdrop_render_children($form); ?> </div> <div class="layout-wrapper clearfix"> <?php print $content; ?> </div> <?php print $actions; ?> </div>
* - $node: The node object for this webform. * - $component: If a single components analysis is being printed, this will * contain a Webform component. Otherwise all components are having their * analysis printed on the same page. * - $analysis: A renderable object containing the following children: * - 'form': A form for selecting which components should be included in the * analysis. * - 'data': An render array of analysis results for each component enabled. */ ?> <div class="webform-analysis"> <?php print backdrop_render($analysis['form']['help']); ?> <div class="webform-analysis-data"> <?php print backdrop_render($analysis['data']); ?> </div> <?php print backdrop_render($analysis['form']); ?> <?php /* Print out any remaining part of the renderable. */ ?> <?php print backdrop_render_children($analysis); ?> </div>