本文整理汇总了PHP中drupal_render_children函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_render_children函数的具体用法?PHP drupal_render_children怎么用?PHP drupal_render_children使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drupal_render_children函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bootstrap_file_widget
/**
* Overrides theme_file_widget().
*/
function bootstrap_file_widget($variables)
{
$element = $variables['element'];
$output = '';
$hidden_elements = array();
foreach (element_children($element) as $child) {
if (isset($element[$child]['#type']) && $element[$child]['#type'] === 'hidden') {
$hidden_elements[$child] = $element[$child];
unset($element[$child]);
}
}
$element['upload_button']['#prefix'] = '<span class="input-group-btn">';
$element['upload_button']['#suffix'] = '</span>';
// The "form-managed-file" class is required for proper Ajax functionality.
if (!empty($element['filename'])) {
$output .= '<div class="file-widget form-managed-file clearfix">';
// Add the file size after the file name.
$element['filename']['#markup'] .= ' <span class="file-size badge">' . format_size($element['#file']->filesize) . '</span>';
} else {
$output .= '<div class="file-widget form-managed-file clearfix input-group">';
}
$output .= drupal_render_children($element);
$output .= '</div>';
$output .= render($hidden_elements);
return $output;
}
示例2: preRenderToolbar
/**
* Builds the Toolbar as a structured array ready for drupal_render().
*
* Since building the toolbar takes some time, it is done just prior to
* rendering to ensure that it is built only if it will be displayed.
*
* @param array $element
* A renderable array.
*
* @return array
* A renderable array.
*
* @see toolbar_page_build().
*/
public static function preRenderToolbar($element)
{
// Get the configured breakpoints to switch from vertical to horizontal
// toolbar presentation.
$breakpoints = static::breakpointManager()->getBreakpointsByGroup('toolbar');
if (!empty($breakpoints)) {
$media_queries = array();
foreach ($breakpoints as $id => $breakpoint) {
$media_queries[$id] = $breakpoint->getMediaQuery();
}
$element['#attached']['js'][] = array('data' => array('toolbar' => array('breakpoints' => $media_queries)), 'type' => 'setting');
}
$module_handler = static::moduleHandler();
// Get toolbar items from all modules that implement hook_toolbar().
$items = $module_handler->invokeAll('toolbar');
// Allow for altering of hook_toolbar().
$module_handler->alter('toolbar', $items);
// Sort the children.
uasort($items, array('\\Drupal\\Component\\Utility\\SortArray', 'sortByWeightProperty'));
// Merge in the original toolbar values.
$element = array_merge($element, $items);
// Render the children.
$element['#children'] = drupal_render_children($element);
return $element;
}
示例3: bootstrap_file_widget
/**
* Overrides theme_file_widget().
*/
function bootstrap_file_widget($variables)
{
$output = '';
$element = $variables['element'];
$element['upload_button']['#attributes']['class'][] = 'btn-primary';
$element['upload_button']['#prefix'] = '<span class="input-group-btn">';
$element['upload_button']['#suffix'] = '</span>';
// The "form-managed-file" class is required for proper Ajax functionality.
if (!empty($element['filename'])) {
$output .= '<div class="file-widget form-managed-file clearfix">';
// Add the file size after the file name.
$element['filename']['#markup'] .= ' <span class="file-size badge">' . format_size($element['#file']->filesize) . '</span>';
} else {
$output .= '<div class="file-widget form-managed-file clearfix input-group">';
}
// Immediately render hidden elements before the rest of the output.
// The uploadprogress extension requires that the hidden identifier input
// element appears before the file input element. They must also be siblings
// inside the same parent element.
// @see https://www.drupal.org/node/2155419
foreach (element_children($element) as $child) {
if (isset($element[$child]['#type']) && $element[$child]['#type'] === 'hidden') {
$output .= drupal_render($element[$child]);
}
}
// Render the rest of the element.
$output .= drupal_render_children($element);
$output .= '</div>';
return $output;
}
示例4: mortgagespeak_preprocess_user_login_block
function mortgagespeak_preprocess_user_login_block(&$vars)
{
$vars['name'] = render($vars['form']['name']);
$vars['pass'] = render($vars['form']['pass']);
$vars['submit'] = render($vars['form']['actions']['submit']);
$vars['rendered'] = drupal_render_children($vars['form']);
}
示例5: springy_file_managed_file
/**
* Overrides theme_file_managed_file().
*/
function springy_file_managed_file($variables)
{
$element = $variables['element'];
$attributes = array();
if (isset($element['#id'])) {
$attributes['id'] = $element['#id'];
}
if (!empty($element['#attributes']['class'])) {
$attributes['class'] = (array) $element['#attributes']['class'];
}
$attributes['class'][] = 'form-managed-file';
$attributes['class'][] = 'input-group';
$element['upload_button']['#prefix'] = '<span class="input group-btn">';
$element['upload_button']['#suffix'] = '</span>';
$element['remove_button']['#prefix'] = '<span class="input group-btn">';
$element['remove_button']['#suffix'] = '</span>';
if (!empty($element['filename'])) {
$element['filename']['#prefix'] = '<div class="form-control">';
$element['filename']['#suffix'] = '</div>';
}
$hidden_elements = array();
foreach (element_children($element) as $child) {
if ($element[$child]['#type'] === 'hidden') {
$hidden_elements[$child] = $element[$child];
unset($element[$child]);
}
}
// This wrapper is required to apply JS behaviors and CSS styling.
$output = '';
$output .= '<div' . drupal_attributes($attributes) . '>';
$output .= drupal_render_children($element);
$output .= '</div>';
$output .= render($hidden_elements);
return $output;
}
示例6: creative_preprocess_user_login_block
function creative_preprocess_user_login_block(&$vars)
{
$vars['form']['name']['#title'] = 'AUC Username';
$vars['name'] = render($vars['form']['name']);
$vars['pass'] = render($vars['form']['pass']);
$vars['submit'] = render($vars['form']['actions']['submit']);
$vars['rendered'] = drupal_render_children($vars['form']);
}
示例7: marketplace_preprocess_user_login_block
function marketplace_preprocess_user_login_block(&$vars)
{
$vars['form']['links']['#markup'] = '<div class="links">Not a member? <a href="' . base_path() . 'user/register">Sign up now</a></div>';
$vars['name'] = render($vars['form']['name']);
$vars['pass'] = render($vars['form']['pass']);
$vars['submit'] = render($vars['form']['actions']['submit']);
$vars['rendered'] = drupal_render_children($vars['form']);
}
示例8: ninesixtyrobots_article_node_form
/**
* Custom function to pull the Published check box out and make it obvious.
*/
function ninesixtyrobots_article_node_form($variables)
{
$form = $variables['form'];
$published = drupal_render($form['status']);
$buttons = drupal_render($form['actions']);
// Make sure we also render the rest of the form, not just our custom stuff.
$everything_else = drupal_render_children($form);
return $everything_else . $published . $buttons;
}
示例9: bootstrap_hpc_preprocess_contact_site_form
function bootstrap_hpc_preprocess_contact_site_form(&$valt)
{
//dpm($valt['']);
$valt['message'] = render($valt['form']['message']);
$valt['subject'] = render($valt['form']['subject']);
$valt['actions'] = render($valt['form']['actions']);
$valt['rendered_form'] = drupal_render_children($valt['form']);
//dpm($valt);
}
示例10: build
/**
* {@inheritdoc}
*/
public function build()
{
$id = $this->getDerivativeId();
$data = drupal_static('ds_block_region');
if (!empty($data[$id])) {
return array('#markup' => drupal_render_children($data[$id]));
} else {
return array();
}
}
示例11: doRenderChildren
public function doRenderChildren($object)
{
if (null === $object || [] === $object) {
return '';
}
if (!is_array($object)) {
throw new \InvalidArgumentException("render_children() input must be an array");
}
return drupal_render_children($object);
}
示例12: bootstrap_date
/**
* Returns HTML for a date selection form element.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #title, #value, #options, #description, #required,
* #attributes.
*
* @return string
* The constructed HTML.
*
* @see theme_date()
*
* @ingroup theme_functions
*/
function bootstrap_date($variables)
{
$element = $variables['element'];
$attributes = array();
if (isset($element['#id'])) {
$attributes['id'] = $element['#id'];
}
if (!empty($element['#attributes']['class'])) {
$attributes['class'] = (array) $element['#attributes']['class'];
}
$attributes['class'][] = 'form-inline';
return '<div' . drupal_attributes($attributes) . '>' . drupal_render_children($element) . '</div>';
}
示例13: apigee_responsive_devconnect_monetization_roles_form
/**
* Overrides theme_devconnect_monetization_roles_form().
*/
function apigee_responsive_devconnect_monetization_roles_form($variables)
{
$form = $variables['form'];
$rows = array();
foreach (element_children($form['developers']) as $uid) {
$row = array();
foreach (element_children($form['developers'][$uid]) as $element) {
$row[] = drupal_render($form['developers'][$uid][$element]);
}
$rows[] = array('data' => $row);
}
$output = '<div class="table-responsive">' . theme_table(array('header' => $form['#table_headers'], 'rows' => $rows, 'attributes' => array('class' => array('table', 'table-bordered')), 'caption' => '', 'colgroups' => array(), 'sticky' => TRUE, 'empty' => t('Your company has no developers assigned.'))) . '</div>' . drupal_render($form['submit']) . drupal_render_children($form);
return $output;
}
示例14: bootstrap_preprocess_user_register
function bootstrap_preprocess_user_register(&$variables)
{
$variables['form']['account']['name']['#title'] = 'choose a username';
$variables['form']['account']['name']['#attributes'] = array('data-placeholder' => $variables['form']['account']['name']['#title']);
$variables['form']['account']['mail']['#title'] = 'your email address';
$variables['form']['account']['mail']['#attributes'] = array('data-placeholder' => $variables['form']['account']['mail']['#title']);
$variables['form']['account']['pass']['pass1']['#title'] = 'Set a password';
$variables['form']['account']['pass']['pass1']['#attributes'] = array('data-placeholder' => $variables['form']['account']['pass']['pass1']['#title'], 'data-input-type' => 'password');
$variables['form']['account']['pass']['pass2']['#type'] = 'textfield';
$variables['form']['account']['pass']['pass2']['#theme'] = 'textfield';
$variables['form']['account']['pass']['pass2']['#autocomplete_path'] = '';
$variables['form']['account']['pass']['pass2']['#title'] = 'Confirm a password';
$variables['form']['account']['pass']['pass2']['#attributes'] = array('data-placeholder' => $variables['form']['account']['pass']['pass2']['#title'], 'data-input-type' => 'password');
$variables['form']['actions']['submit']['#value'] = 'create my account';
unset($variables['form']['account']['name']['#size']);
unset($variables['form']['account']['mail']['#size']);
unset($variables['form']['account']['pass']['pass1']['#size']);
unset($variables['form']['account']['pass']['pass2']['#size']);
$variables['rendered'] = drupal_render_children($variables['form']);
}
示例15: bootstrap_exposed_filters
/**
* Overrides theme_exposed_filters().
*/
function bootstrap_exposed_filters($variables)
{
$form = $variables['form'];
$output = '';
foreach (element_children($form['status']['filters']) as $key) {
$form['status']['filters'][$key]['#field_prefix'] = '<div class="col-sm-10">';
$form['status']['filters'][$key]['#field_suffix'] = '</div>';
}
$form['status']['actions']['#attributes']['class'][] = 'col-sm-offset-2';
$form['status']['actions']['#attributes']['class'][] = 'col-sm-10';
if (isset($form['current'])) {
$items = array();
foreach (element_children($form['current']) as $key) {
$items[] = drupal_render($form['current'][$key]);
}
$output .= theme('item_list', array('items' => $items, 'attributes' => array('class' => array('clearfix', 'current-filters'))));
}
$output .= drupal_render_children($form);
return '<div class="form-horizontal">' . $output . '</div>';
}