当前位置: 首页>>代码示例>>PHP>>正文


PHP element_children函数代码示例

本文整理汇总了PHP中element_children函数的典型用法代码示例。如果您正苦于以下问题:PHP element_children函数的具体用法?PHP element_children怎么用?PHP element_children使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了element_children函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
}
开发者ID:lluisandreu,项目名称:drupal7,代码行数:38,代码来源:file-managed-file.func.php

示例2: pol_proc_admin_diff_node_revisions

/**
 * Theme function to display the revisions formular.
 *
 * Overridden to simply change some terminology (e.g. current revison -> current
 * version).
 */
function pol_proc_admin_diff_node_revisions($vars)
{
    $form = $vars['form'];
    $output = '';
    // Overview table:
    $header = array(t('Revision'), array('data' => drupal_render($form['submit']), 'colspan' => 2), array('data' => t('Operations'), 'colspan' => 2));
    if (isset($form['info']) && is_array($form['info'])) {
        foreach (element_children($form['info']) as $key) {
            $row = array();
            if (isset($form['operations'][$key][0])) {
                // Note: even if the commands for revert and delete are not permitted,
                // the array is not empty since we set a dummy in this case.
                $row[] = drupal_render($form['info'][$key]);
                $row[] = drupal_render($form['diff']['old'][$key]);
                $row[] = drupal_render($form['diff']['new'][$key]);
                $row[] = drupal_render($form['operations'][$key][0]);
                $row[] = drupal_render($form['operations'][$key][1]);
                $rows[] = array('data' => $row, 'class' => array('diff-revision'));
            } else {
                // The current revision (no commands to revert or delete).
                $row[] = array('data' => drupal_render($form['info'][$key]), 'class' => array('revision-current'));
                $row[] = array('data' => drupal_render($form['diff']['old'][$key]), 'class' => array('revision-current'));
                $row[] = array('data' => drupal_render($form['diff']['new'][$key]), 'class' => array('revision-current'));
                $row[] = array('data' => t('current version'), 'class' => array('revision-current'), 'colspan' => '2');
                $rows[] = array('data' => $row, 'class' => array('error diff-revision'));
            }
        }
    }
    $output .= theme('table__diff__revisions', array('header' => $header, 'rows' => $rows, 'sticky' => FALSE, 'attributes' => array('class' => 'diff-revisions')));
    $output .= drupal_render_children($form);
    return $output;
}
开发者ID:NREL,项目名称:drupal-ecleds-enter,代码行数:38,代码来源:template.php

示例3: wspine_test_preprocess_page

function wspine_test_preprocess_page(&$vars, $hook)
{
    if (isset($vars['node_title'])) {
        $vars['title'] = $vars['node_title'];
    }
    // Adding a class to #page in wireframe mode
    if (theme_get_setting('wireframe_mode')) {
        $vars['classes_array'][] = 'wireframe-mode';
    }
    // Adding classes wether #navigation is here or not
    if (!empty($vars['main_menu']) or !empty($vars['sub_menu'])) {
        $vars['classes_array'][] = 'with-navigation';
    }
    if (!empty($vars['secondary_menu'])) {
        $vars['classes_array'][] = 'with-subnav';
    }
    // Add first/last classes to node listings about to be rendered.
    if (isset($vars['page']['content']['system_main']['nodes'])) {
        // All nids about to be loaded (without the #sorted attribute).
        $nids = element_children($vars['page']['content']['system_main']['nodes']);
        // Only add first/last classes if there is more than 1 node being rendered.
        if (count($nids) > 1) {
            $first_nid = reset($nids);
            $last_nid = end($nids);
            $first_node = $vars['page']['content']['system_main']['nodes'][$first_nid]['#node'];
            $first_node->classes_array = array('first');
            $last_node = $vars['page']['content']['system_main']['nodes'][$last_nid]['#node'];
            $last_node->classes_array = array('last');
        }
    }
}
开发者ID:rchicb,项目名称:wspine_test,代码行数:31,代码来源:template.php

示例4: basetpl_process_page

/**
 * Implements theme_process_page().
 */
function basetpl_process_page(&$variables)
{
    global $base_path;
    // show/hide breadcrumb
    $variables['show_breadcrumb'] = TRUE;
    // var theme_path
    $variables['theme_path'] = $base_path . path_to_theme();
    // var site_info
    $variables['site_info'] = $variables['logo'] || $variables['site_name'] || $variables['site_slogan'] ? TRUE : FALSE;
    // check if page is system page
    $variables['system_page'] = isset($variables['node']) ? FALSE : TRUE;
    // backend
    if (user_is_logged_in() && path_is_admin(current_path())) {
        $variables['site_info'] = FALSE;
        $variables['system_page'] = TRUE;
        foreach (element_children($variables['page']) as $region) {
            if ($region != 'content') {
                $variables['page'][$region] = FALSE;
            }
        }
    }
    // show/hide page title
    $variables['title'] = $variables['system_page'] ? $variables['title'] : FALSE;
    // add robots to head
    if (theme_get_setting('robots') == 1) {
        $robots = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'robots', 'content' => 'noindex,nofollow'));
        drupal_add_html_head($robots, 'robots');
    }
}
开发者ID:bert-bruggeman,项目名称:e2e_themes,代码行数:32,代码来源:page.inc.php

示例5: 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;
}
开发者ID:victor-galguera,项目名称:Mexico-Nueva-Era,代码行数:29,代码来源:file-widget.func.php

示例6: badm_form_node_form_pre_render

/**
 * Alters the node form on pre_render -ie. after all the real form processing
 * happened- thus ensuring we can move elements around without interacting with
 * form validation and submission processes.
 */
function badm_form_node_form_pre_render($form)
{
    if (!isset($form['additional_settings']) || isset($form['additional_settings']['#access']) && !$form['additional_settings']['#access'] || isset($form['additional_settings']['additional_settings__active_tab']) && count(element_children($form['additional_settings']['additional_settings__active_tab'])) == 0) {
        return $form;
    }
    // Exclude all non visible items. Note that fieldset will have a specific
    // case in the foreach loop.
    $excluded_types = ['value' => true, 'hidden' => true, 'token' => true, 'actions' => true, 'vertical_tabs' => true];
    foreach (element_children($form) as $key) {
        $element = $form[$key];
        $type = isset($element['#type']) ? $element['#type'] : null;
        if (isset($excluded_types[$type])) {
            continue;
        }
        switch ($type) {
            case 'fieldset':
                if (isset($element['#group']) && 'additional_settings' === $element['#group']) {
                    // Leave the ungrouped fieldset go down the road to the default
                    // behavior and be moved into the orphans container.
                    break;
                }
            default:
                $form['node_form_orphans'][$key] = $element;
                // This breaks ordering... Ideally ordering would need to be restored
                // at the field config level in order to avoid further bad surprises
                // but instead we just force the reordering below.
                unset($form[$key]);
                break;
        }
    }
    uasort($form['node_form_orphans'], 'element_sort');
    // Activate tab.
    $form['node_form_orphans']['#access'] = TRUE;
    return $form;
}
开发者ID:makinacorpus,项目名称:drupal-badm,代码行数:40,代码来源:template.php

示例7: reset_preprocess_views_view_grid

/**
 * Display a view as a grid style.
 */
function reset_preprocess_views_view_grid(&$vars)
{
    drupal_add_css(drupal_get_path('theme', 'reset') . '/css/views-view-grid.css');
    foreach (element_children($vars['row_classes']) as $key => $value) {
        $vars['row_classes'][$key] .= 'view-grid-row has-' . $vars['options']['columns'] . '-cols';
    }
}
开发者ID:TerraZero,项目名称:dz_project,代码行数:10,代码来源:template.php

示例8: 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;
}
开发者ID:lcube45,项目名称:hyx,代码行数:33,代码来源:file-widget.func.php

示例9: druio_theme_preprocess_html

/**
 * Implements template_preprocess_html().
 */
function druio_theme_preprocess_html(&$variables)
{
    // Redefine body classes.
    $variables['classes_array'] = array();
    $element_children = element_children($variables['page']['sidebar']);
    if (!empty($element_children)) {
        $variables['classes_array'][] = 'sidebar';
    } else {
        $variables['classes_array'][] = 'no-sidebars';
    }
    if (drupal_is_front_page()) {
        $variables['classes_array'][] = 'frontpage';
    }
    if (user_is_logged_in()) {
        $variables['classes_array'][] = 'registered';
    } else {
        $variables['classes_array'][] = 'anonymous';
    }
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $variables['classes_array'][] = drupal_html_class('page-404');
    }
    if ($status == "403 Forbidden") {
        $variables['classes_array'][] = drupal_html_class('page-403');
    }
}
开发者ID:isaenkov,项目名称:Dru.io,代码行数:29,代码来源:template.php

示例10: tradjenta_qt_quicktabs_tabset

function tradjenta_qt_quicktabs_tabset($vars)
{
    $variables = array('attributes' => array('class' => 'quicktabs-tabs m-tabs-header quicktabs-style-' . $vars['tabset']['#options']['style']), 'items' => array());
    $last_key = key(array_slice($vars['tabset']['tablinks'], -1, 1, TRUE));
    foreach (element_children($vars['tabset']['tablinks']) as $key) {
        $item = array();
        if (is_array($vars['tabset']['tablinks'][$key])) {
            $tab = $vars['tabset']['tablinks'][$key];
            $item['class'] = array('tab');
            if ($key == $vars['tabset']['#options']['active']) {
                array_push($item['class'], 'active');
            }
            switch ($key) {
                case '0':
                    array_push($item['class'], 'tab-straight', 'tab-straight-left');
                    break;
                case '1':
                    array_push($item['class'], 'tab-skewed', 'tab-skewed-first');
                    break;
                case '2':
                    array_push($item['class'], 'tab-skewed', 'tab-skewed-last');
                    break;
                case '3':
                    array_push($item['class'], 'tab-straight', 'tab-straight-right');
                    break;
                default:
                    array_push($item['class'], 'tab-skewed', 'tab-skewed-first');
                    break;
            }
            $item['data'] = drupal_render($tab);
            $variables['items'][] = $item;
        }
    }
    return theme('item_list', $variables);
}
开发者ID:sevvels,项目名称:tradjenta,代码行数:35,代码来源:template.php

示例11: walkhub_theme_form_walkthrough_set_node_form_alter

function walkhub_theme_form_walkthrough_set_node_form_alter(&$form, &$form_state, $form_id)
{
    if (!empty($form['field_walkthroughs'][LANGUAGE_NONE])) {
        foreach (element_children($form['field_walkthroughs'][LANGUAGE_NONE]) as $key) {
            $form['field_walkthroughs'][LANGUAGE_NONE][$key]['#theme'] = 'walkthrough_set_steps_edit_form';
        }
    }
}
开发者ID:jpstrikesback,项目名称:WalkHub,代码行数:8,代码来源:template.php

示例12: bootstrap_preprocess_admin_menu_links

/**
 * Pre-processes variables for the "admin_menu_links" theme hook.
 *
 * @param array $variables
 *   - elements: A renderable array of links using the following keys:
 *     - #attributes: Optional array of attributes for the list item, processed
 *       via drupal_attributes().
 *     - #title: Title of the link, passed to l().
 *     - #href: Optional path of the link, passed to l(). When omitted, the
 *       element's '#title' is rendered without link.
 *     - #description: Optional alternative text for the link, passed to l().
 *     - #options: Optional alternative text for the link, passed to l().
 *     The array key of each child element itself is passed as path for l().
 *
 * @see theme_admin_menu_links()
 *
 * @ingroup theme_preprocess
 */
function bootstrap_preprocess_admin_menu_links(&$variables)
{
    $elements =& $variables['elements'];
    foreach (element_children($elements) as $child) {
        $elements[$child]['#bootstrap_ignore_pre_render'] = TRUE;
        $elements[$child]['#bootstrap_ignore_process'] = TRUE;
    }
}
开发者ID:drupdateio,项目名称:gvj,代码行数:26,代码来源:admin-menu-links.vars.php

示例13: _mdl_links

/**
 * Helper function to output a Drupal menu as a Foundation Top Bar.
 *
 * @links array
 *   An array of menu links.
 *
 * @return string
 *   A rendered list of links, with no <ul> or <ol> wrapper.
 *
 * @see mdl_links__system_main_menu()
 * @see mdl_links__system_secondary_menu()
 */
function _mdl_links($links)
{
    $output = '';
    foreach (element_children($links) as $key) {
        $output .= _mdl_render_link($links[$key]);
    }
    return $output;
}
开发者ID:zacdavidm,项目名称:mdl,代码行数:20,代码来源:template.php

示例14: apigee_responsive_devconnect_monetization_recurring_balances

/**
 * Overrides theme_devconnect_monetization_recurring_balances().
 */
function apigee_responsive_devconnect_monetization_recurring_balances($vars)
{
    $rows = array();
    foreach (element_children($vars['balances']['items']) as $currency) {
        $rows[] = array(array('data' => $vars['balances']['items'][$currency]['charge_per_usage']), array('data' => $vars['balances']['items'][$currency]['is_recurring']), array('data' => $vars['balances']['items'][$currency]['#provider']), array('data' => $vars['balances']['items'][$currency]['#currency']), array('data' => $vars['balances']['items'][$currency]['recurring_amount']), array('data' => $vars['balances']['items'][$currency]['replenish_amount']));
    }
    $header = array(t('Charge per Usage'), t('Recurring'), t('Provider'), t('Currency'), t('Recurring Amount'), t('Replenish Amount'));
    return '<div class="table-responsive">' . theme('table', array('header' => $header, 'rows' => $rows)) . '</div>';
}
开发者ID:nevetS,项目名称:flame,代码行数:12,代码来源:template.php

示例15: unikue_preprocess_comment

/**
 * Process variables for comment.tpl.php.
 *
 * @see comment.tpl.php
 */
function unikue_preprocess_comment(&$variables)
{
    $comment = $variables['elements']['#comment'];
    $node = $variables['elements']['#node'];
    $variables['comment'] = $comment;
    $variables['node'] = $node;
    $variables['author'] = theme('username', array('account' => $comment));
    $variables['created'] = date('d F Y', $comment->created);
    // Avoid calling format_date() twice on the same timestamp.
    if ($comment->changed == $comment->created) {
        $variables['changed'] = $variables['created'];
    } else {
        $variables['changed'] = format_date($comment->changed);
    }
    $variables['new'] = !empty($comment->new) ? t('new') : '';
    $variables['picture'] = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', array('account' => $comment)) : '';
    $variables['signature'] = $comment->signature;
    $uri = entity_uri('comment', $comment);
    $uri['options'] += array('attributes' => array('class' => 'permalink', 'rel' => 'bookmark'));
    $variables['title'] = l($comment->subject, $uri['path'], $uri['options']);
    $variables['permalink'] = l(t('Permalink'), $uri['path'], $uri['options']);
    $variables['submitted'] = t('!username  on !datetime', array('!username' => $variables['author'], '!datetime' => date('d/m/Y', $comment->created)));
    // Preprocess fields.
    field_attach_preprocess('comment', $comment, $variables['elements'], $variables);
    // Helpful $content variable for templates.
    foreach (element_children($variables['elements']) as $key) {
        $variables['content'][$key] = $variables['elements'][$key];
    }
    // Set status to a string representation of comment->status.
    if (isset($comment->in_preview)) {
        $variables['status'] = 'comment-preview';
    } else {
        $variables['status'] = $comment->status == COMMENT_NOT_PUBLISHED ? 'comment-unpublished' : 'comment-published';
    }
    // Gather comment classes.
    // 'comment-published' class is not needed, it is either 'comment-preview' or
    // 'comment-unpublished'.
    if ($variables['status'] != 'comment-published') {
        $variables['classes_array'][] = $variables['status'];
    }
    if ($variables['new']) {
        $variables['classes_array'][] = 'comment-new';
    }
    if (!$comment->uid) {
        $variables['classes_array'][] = 'comment-by-anonymous';
    } else {
        if ($comment->uid == $variables['node']->uid) {
            $variables['classes_array'][] = 'comment-by-node-author';
        }
        if ($comment->uid == $variables['user']->uid) {
            $variables['classes_array'][] = 'comment-by-viewer';
        }
    }
    foreach ($variables['content']['links']['comment']['#links'] as $key => $value) {
        $variables['content']['links']['comment']['#links'][$key]['attributes']['class'] = array('button button-small');
    }
}
开发者ID:toptomatotwo,项目名称:tomwebdev,代码行数:62,代码来源:comment.vars.php


注:本文中的element_children函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。