• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP node_view函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: water_preprocess_page

/**
 * Preprocess variables for page.tpl.php
 * default variales for page.tpl.php:
 * $logo, $front_page, $site_name, $site_slogan, $messages
 * $title_prefix, $title_suffix, $tabs, $action_links
 * $feed_icons, $breadcrumb
 */
function water_preprocess_page(&$vars)
{
    if (isset($vars['node'])) {
        // If the node type is "blog_madness" the template suggestion will be "page--blog-madness.tpl.php".
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
        if ($vars['node']->type == 'deprecated_organization') {
            //var_dump($vars['node']);
            //$vars['organization_geolocation'] = array($vars['node']->field_latitude['und']['0']['value'], $vars['node']->field_longitude['und']['0']['value']);
            /*
             * LOAD GMAPS MODULE
             */
            //add html element 'organization-gmap-canvas' in template file that will hold Google map
            //Load gmap3_tools.inc file
            module_load_include('inc', 'gmap3_tools');
            //all gmap3_tools_add_map() function from API file with appropriate map configuratio array
            gmap3_tools_add_map(array('mapId' => 'organization-gmap-canvas', 'mapOptions' => array('centerX' => -34.397, 'centerY' => 150.644, 'zoom' => 12), 'markers' => array(gmap3_tools_create_marker(-1, -1, 'Home', 'Home')), 'geocodeAddress' => $vars['node']->field_city['und']['0']['taxonomy_term']->name, 'gmap3ToolsOptions' => array('defaultMarkersPosition' => GMAP3_TOOLS_DEFAULT_MARKERS_POSITION_CENTER)));
        }
        //create a variable to hold rich title field added to specific content types
        $view = node_view($vars['node']);
        $vars['rich_title'] = render($view['field_rich_title']);
    }
    //var_dump($vars);
    //var_export($vars);
    //var_dump(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
    //    $vars['contact_form'] = drupal_render(drupal_get_form('contact_site_form'));
}
开发者ID:VTsantilis,项目名称:water-test,代码行数:33,代码来源:template.php


示例2: HOOK_builder_content_view

/**
 * HOOK_builder_content_view()
 */
function HOOK_builder_content_view($delta = '', $content = array())
{
    $content = '';
    switch ($delta) {
        case 'node':
            $node_content = '';
            if (!empty($content['settings']['nid'])) {
                $nid = $content['settings']['nid'];
                if ($node = node_load($nid)) {
                    if (isset($content['settings']['hide_node_title']) && $content['settings']['hide_node_title']) {
                        // hide node title.
                        $node->title = FALSE;
                    }
                    $node_view = node_view($node, $content['settings']['view_mode']);
                    $node_content = render($node_view);
                }
            }
            $content['content'] = $node_content;
            break;
        case 'custom_text':
            $custom_text_value = isset($content['settings']['custom_text']['value']) ? $content['settings']['custom_text']['value'] : '';
            if (isset($content['settings']['custom_text']['format'])) {
                $custom_text_value = check_markup($custom_text_value, $content['settings']['custom_text']['format']);
            }
            $content['content'] = $custom_text_value;
            break;
            return $content;
    }
}
开发者ID:vitkuz,项目名称:superfield,代码行数:32,代码来源:builder.api.php


示例3: gallery

  /**
   * Gallery display.
   *
   * @return string
   *   Return Gallery output string.
   */
  public function gallery() {

    // Load the language manager service, so we can parse the user's current language.
    $langcode    = $this->languageManager()->getCurrentLanguage('language');

    $photographs = $this->loadAllPhotos();
    $view_mode   = 'teaser';
    $gallery     = array();

    // Loop through the loaded photograph node objects and output their rendered result into a list.
    foreach ($photographs as $photograph) {
      $render    = node_view($photograph, $view_mode, $langcode);
      $gallery[] = render($render);
    }

    // If the gallery is empty, we should apologise.
    if (empty($gallery)) {
      return [
        '#type' => 'markup',
        '#markup' => $this->t('Sorry, I have no photographs to share at the moment'),
        '#prefix' => '<h2>',
        '#suffix' => '</h2>',
      ];
    }

    // Return an item list of photographs for our gallery.
    return [
      '#theme' => 'item_list',
      '#items' => $gallery,
    ];

  }
开发者ID:emarchak,项目名称:drupal-8-every-day,代码行数:38,代码来源:GalleryController.php


示例4: contentOverview

  /**
   * Returns content for recent images.
   *
   * @return string
   *   A HTML-formatted string with the administrative page content.
   *
   */
  public function contentOverview() {
    // @todo a lot of duplicate code can be consolidated in these controllers.
    $query = db_select('node', 'n')
      ->extend('Drupal\Core\Database\Query\PagerSelectExtender');
    $query->join('photos_album', 'p', 'p.pid = n.nid');
    $query->fields('n', array('nid'));
    $query->orderBy('n.nid', 'DESC');
    $query->limit(10);
    $query->addTag('node_access');
    $results = $query->execute();

    $output = '';
    foreach ($results as $result) {
      $node = \Drupal::entityManager()->getStorage('node')->load($result->nid);
      $node_view = node_view($node, 'full');
      $output .= \Drupal::service("renderer")->render($node_view);
    }
    if ($output) {
      $pager = array(
        '#type' => 'pager'
      );
      $output .= \Drupal::service("renderer")->render($pager);
    }
    else {
      $output .= t('No albums have been created yet.');
    }

    return array(
      '#markup' => $output
    );
  }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:38,代码来源:PhotosAlbumsRecentController.php


示例5: _pol_proc_admin_node_preview

/**
 * Returns HTML for a node preview for display during node creation and editing.
 *
 * Overrides theme_node_preview() in modules/node/node.pages.inc.
 *
 * @param $variables
 *   An associative array containing:
 *   - node: The node object which is being previewed.
 *
 * @see node_preview()
 * @ingroup themeable
 */
function _pol_proc_admin_node_preview($variables)
{
    $node = $variables['node'];
    $output = '<div class="preview">';
    /*if ('policy' == $node->type) {
        dsm($variables);
        // Load the node into a context.
        ctools_include('node_view', 'page_manager', 'plugins/tasks');
        $elements = page_manager_node_view_page(clone $node);
        $output .= drupal_render($elements);
        drupal_add_css(drupal_get_path('theme', 'pol_proc_theme') . '/css/colors.css');
        drupal_add_css(drupal_get_path('theme', 'pol_proc_theme') . '/css/site.css');
      } elseif ('procedure' == $node->type) {
        $output = _pol_proc_admin_node_procedure_preview($node);
      } else { */
    $preview_trimmed_version = FALSE;
    $elements = node_view(clone $node, 'teaser');
    $trimmed = drupal_render($elements);
    $elements = node_view($node, 'full');
    $full = drupal_render($elements);
    // Do we need to preview trimmed version of post as well as full version?
    if ($trimmed != $full) {
        drupal_set_message(t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication.<span class="no-js"> You can insert the delimiter "&lt;!--break--&gt;" (without the quotes) to fine-tune where your post gets split.</span>'));
        $output .= '<h3>' . t('Preview trimmed version') . '</h3>';
        $output .= $trimmed;
        $output .= '<h3>' . t('Preview full version') . '</h3>';
        $output .= $full;
    } else {
        $output .= $full;
    }
    //}
    $output .= "</div>\n";
    return $output;
}
开发者ID:NREL,项目名称:drupal-ecleds-enter,代码行数:46,代码来源:template.php


示例6: getNode

 /**
  * Drupal example
  */
 public function getNode()
 {
     $node = new \erdiko\drupal\models\Node();
     $post = $node->getNode(1);
     $content = \drupal_render(\node_view($post));
     $content .= "<pre>" . print_r($post, true) . "</pre>";
     $this->setContent($content);
 }
开发者ID:saarmstrong,项目名称:erdiko-drupal,代码行数:11,代码来源:Example.php


示例7: hook_proximity_ajax_render_item_alter

/**
 * Returns the item specific content as render array or html string.
 *
 * The parameter $param contains the unique load parameter of the requested item.
 *
 * @param $container_index      int     Index of proximity container (if more than one container exists in one page).
 * @param $param                string  The item specific load parameter (see also hook_proximity_ajax_load_params_alter).
 * @param $render_item          mixed   The rendered content to be returned to the client. The $render_item should be
 *                                      replaced either by a string (rendered html content), a render array or an integer (error code).
 */
function hook_proximity_ajax_render_item_alter($container_index, $param, &$render_item)
{
    // Example: the $param variable contains a node id (see hook_proximity_ajax_load_params_alter),
    // return the render array for the specific node
    if ($node = node_load($param)) {
        $render_item = node_view($node);
    }
}
开发者ID:PixelGarage,项目名称:derpolder,代码行数:18,代码来源:proximity.api.php


示例8: execute

 /**
  * {@inheritdoc}
  */
 public function execute($node = NULL)
 {
     foreach ($this->configuration['keywords'] as $keyword) {
         $elements = node_view(clone $node);
         if (strpos(drupal_render($elements), $keyword) !== FALSE || strpos($node->label(), $keyword) !== FALSE) {
             $node->setPublished(FALSE);
             $node->save();
             break;
         }
     }
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:14,代码来源:UnpublishByKeywordNode.php


示例9: revisionShow

 /**
  * Displays a node revision.
  *
  * @param int $node_revision
  *   The node revision ID.
  *
  * @return array
  *   An array suitable for drupal_render().
  */
 public function revisionShow($node_revision)
 {
     /** @var NodeInterface $node */
     $node = $this->entityTypeManager()->getStorage('node')->loadRevision($node_revision);
     // Determine view mode.
     $view_mode = \Drupal::config('ds_extras.settings')->get('override_node_revision_view_mode');
     drupal_static('ds_view_mode', $view_mode);
     $page = node_view($node, $view_mode);
     unset($page['nodes'][$node->id()]['#cache']);
     return $page;
 }
开发者ID:neeravbm,项目名称:unify-d8,代码行数:20,代码来源:DsExtrasController.php


示例10: nbadraft_main_form_submit

function nbadraft_main_form_submit($form, &$form_status)
{
    $form_status['rebuild'] = TRUE;
    $draft_team_tid = $form_status['values']['draft_team'];
    $draft_year_tid = $form_status['values']['draft_year'];
    $nodes = get_draft_picks_for_team_year($draft_year_tid, $draft_team_tid);
    $form_status['storage']['results'] = array();
    foreach ($nodes as $node) {
        $form_status['storage']['results'][] = node_view($node, 'teaser');
    }
}
开发者ID:eganr,项目名称:nba-draft-lookup,代码行数:11,代码来源:template.php


示例11: getValue

 /**
  * {@inheritdoc}
  */
 public function getValue(ResultRow $values, $field = NULL)
 {
     $nid = parent::getValue($values, $field);
     if (!is_null($nid)) {
         // @todo Refactor to allow display price to be calculated.
         $node = node_load($nid);
         return $node->price->value;
         // !TODO Refactor so that all variants are loaded at once in the pre_render hook.
         $node = node_view(node_load($nid), 'teaser');
         return $node['display_price']['#value'];
     }
 }
开发者ID:pedrocones,项目名称:hydrotools,代码行数:15,代码来源:DisplayPrice.php


示例12: renderChart

 /**
  * Provides the replacement html to be rendered in place of the embed code.
  *
  * Does not handle nested embeds.
  *
  * @param array $matches
  *   Array of matches by preg_replace_callback
  *
  * @return string
  *   The rendered HTML replacing the embed code
  */
 public function renderChart($matches)
 {
     /* @var $node \Drupal\Node\NodeInterface */
     $node = Node::load($matches[1]);
     if ($node == FALSE || !$node->isPublished() || !$node->access('view')) {
         return "[[chart-nid:{$matches[1]},chart-view-mode:{$matches[2]}]]";
     } else {
         $view = node_view($node, $matches[2]);
         $render = drupal_render($view);
         return $render;
     }
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:23,代码来源:Easychart.php


示例13: nodeView

 public function nodeView($node, $view_mode = 'full')
 {
     if (empty($node)) {
         return '';
     }
     if (is_array($node)) {
         $build = node_view_multiple($node, $view_mode);
     } else {
         $build = node_view($node, $view_mode);
     }
     return drupal_render($build);
 }
开发者ID:makinacorpus,项目名称:drupal-sf-dic,代码行数:12,代码来源:DrupalNodeExtension.php


示例14: testTwigDebugMarkup

 /**
  * Tests debug markup added to Twig template output.
  */
 function testTwigDebugMarkup()
 {
     /** @var \Drupal\Core\Render\RendererInterface $renderer */
     $renderer = $this->container->get('renderer');
     $extension = twig_extension();
     \Drupal::service('theme_handler')->install(array('test_theme'));
     \Drupal::service('theme_handler')->setDefault('test_theme');
     $this->drupalCreateContentType(array('type' => 'page'));
     // Enable debug, rebuild the service container, and clear all caches.
     $parameters = $this->container->getParameter('twig.config');
     $parameters['debug'] = TRUE;
     $this->setContainerParameter('twig.config', $parameters);
     $this->rebuildContainer();
     $this->resetAll();
     $cache = $this->container->get('theme.registry')->get();
     // Create array of Twig templates.
     $templates = drupal_find_theme_templates($cache, $extension, drupal_get_path('theme', 'test_theme'));
     $templates += drupal_find_theme_templates($cache, $extension, drupal_get_path('module', 'node'));
     // Create a node and test different features of the debug markup.
     $node = $this->drupalCreateNode();
     $build = node_view($node);
     $output = $renderer->renderRoot($build);
     $this->assertTrue(strpos($output, '<!-- THEME DEBUG -->') !== FALSE, 'Twig debug markup found in theme output when debug is enabled.');
     $this->setRawContent($output);
     $this->assertTrue(strpos($output, "THEME HOOK: 'node'") !== FALSE, 'Theme call information found.');
     $this->assertTrue(strpos($output, '* node--1--full' . $extension . PHP_EOL . '   x node--1' . $extension . PHP_EOL . '   * node--page--full' . $extension . PHP_EOL . '   * node--page' . $extension . PHP_EOL . '   * node--full' . $extension . PHP_EOL . '   * node' . $extension) !== FALSE, 'Suggested template files found in order and node ID specific template shown as current template.');
     $this->assertEscaped('node--<script type="text/javascript">alert(\'yo\');</script>');
     $template_filename = $templates['node__1']['path'] . '/' . $templates['node__1']['template'] . $extension;
     $this->assertTrue(strpos($output, "BEGIN OUTPUT from '{$template_filename}'") !== FALSE, 'Full path to current template file found.');
     // Create another node and make sure the template suggestions shown in the
     // debug markup are correct.
     $node2 = $this->drupalCreateNode();
     $build = node_view($node2);
     $output = $renderer->renderRoot($build);
     $this->assertTrue(strpos($output, '* node--2--full' . $extension . PHP_EOL . '   * node--2' . $extension . PHP_EOL . '   * node--page--full' . $extension . PHP_EOL . '   * node--page' . $extension . PHP_EOL . '   * node--full' . $extension . PHP_EOL . '   x node' . $extension) !== FALSE, 'Suggested template files found in order and base template shown as current template.');
     // Create another node and make sure the template suggestions shown in the
     // debug markup are correct.
     $node3 = $this->drupalCreateNode();
     $build = array('#theme' => 'node__foo__bar');
     $build += node_view($node3);
     $output = $renderer->renderRoot($build);
     $this->assertTrue(strpos($output, "THEME HOOK: 'node__foo__bar'") !== FALSE, 'Theme call information found.');
     $this->assertTrue(strpos($output, '* node--foo--bar' . $extension . PHP_EOL . '   * node--foo' . $extension . PHP_EOL . '   * node--&lt;script type=&quot;text/javascript&quot;&gt;alert(&#039;yo&#039;);&lt;/script&gt;' . $extension . PHP_EOL . '   * node--3--full' . $extension . PHP_EOL . '   * node--3' . $extension . PHP_EOL . '   * node--page--full' . $extension . PHP_EOL . '   * node--page' . $extension . PHP_EOL . '   * node--full' . $extension . PHP_EOL . '   x node' . $extension) !== FALSE, 'Suggested template files found in order and base template shown as current template.');
     // Disable debug, rebuild the service container, and clear all caches.
     $parameters = $this->container->getParameter('twig.config');
     $parameters['debug'] = FALSE;
     $this->setContainerParameter('twig.config', $parameters);
     $this->rebuildContainer();
     $this->resetAll();
     $build = node_view($node);
     $output = $renderer->renderRoot($build);
     $this->assertFalse(strpos($output, '<!-- THEME DEBUG -->') !== FALSE, 'Twig debug markup not found in theme output when debug is disabled.');
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:56,代码来源:TwigDebugMarkupTest.php


示例15: pixelgarage_proximity_ajax_render_item_alter

/**
 * Returns the item specific content as render array or html string. The $param attribute contains the item specific parameter
 * added to the ajax request.
 *
 * @param $container_index      int     Index of proximity container (if more than one container exists in one page).
 * @param $param                string  The item specific load parameter (see also hook_proximity_ajax_load_params_alter).
 * @param $render_item          mixed   The rendered content to be returned to the client. The $render_item should be
 *                                      replaced either by a string (rendered html content), a render array or an integer (error code).
 */
function pixelgarage_proximity_ajax_render_item_alter($container_index, $param, &$render_item)
{
    // return the render array for the specific node, if available
    if ($node = node_load($param)) {
        $view_mode = 'full';
        if (property_exists($node, 'ds_switch')) {
            // take an alternate view mode set by the ds switch
            $view_mode = $node->ds_switch;
        }
        $render_item = node_view($node, $view_mode);
    }
}
开发者ID:PixelGarage,项目名称:derpolder,代码行数:21,代码来源:template.php


示例16: viewAnswer

 /**
  * Helper function to setup the faq answer.
  *
  * @param array &$data
  *   Array reference to store display data in.
  * @param Drupal\node\NodeInterface $node
  *   The node object.
  * @param string $back_to_top
  *   An array containing the "back to top" link.
  * @param bool $teaser
  *   Whether or not to use teasers.
  * @param bool $links
  *   Whether or not to show node links.
  */
 public static function viewAnswer(&$data, \Drupal\node\NodeInterface $node, $teaser)
 {
     $faq_settings = \Drupal::config('faq.settings');
     // TODO: hide 'submitted by ... on ...'
     $view_mode = $teaser ? 'teaser' : 'full';
     $node_build = node_view($node, $view_mode);
     hide($node_build['title']);
     if (!$faq_settings->get('question_long_form')) {
         hide($node_build['field_detailed_question']);
     }
     $content = drupal_render($node_build);
     $content .= FaqViewer::initBackToTop();
     $data['body'] = SafeMarkup::set($content);
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:28,代码来源:FaqViewer.php


示例17: spartan_preprocess_region

/**
 * Implements hook_preprocess_region().
 */
function spartan_preprocess_region(&$vars)
{
    global $language;
    switch ($vars['region']) {
        // Menu region.
        case 'menu':
            $footer_menu_cache = cache_get("footer_menu_data:" . $language->language);
            if ($footer_menu_cache) {
                $footer_menu = $footer_menu_cache->data;
            } else {
                $footer_menu = menu_tree_output(_spartan_menu_build_tree('main-menu', array('max_depth' => 2)));
                cache_set("footer_menu_data:" . $language->language, $footer_menu);
            }
            //set the active trail
            $active_trail = menu_get_active_trail();
            foreach ($active_trail as $trail) {
                if (isset($trail['mlid']) && isset($footer_menu[$trail['mlid']])) {
                    $footer_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail';
                }
            }
            $vars['dropdown_menu'] = $footer_menu;
            break;
            // Default footer content.
        // Default footer content.
        case 'footer_first':
            $footer_menu_cache = cache_get("footer_menu_data:" . $language->language);
            if ($footer_menu_cache) {
                $footer_menu = $footer_menu_cache->data;
            } else {
                $footer_menu = menu_tree_output(_spartan_menu_build_tree('main-menu', array('max_depth' => 2)));
                cache_set("footer_menu_data:" . $language->language, $footer_menu);
            }
            //set the active trail
            $active_trail = menu_get_active_trail();
            foreach ($active_trail as $trail) {
                if (isset($trail['mlid']) && isset($footer_menu[$trail['mlid']])) {
                    $footer_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail';
                }
            }
            $vars['footer_menu'] = $footer_menu;
            $vars['site_name'] = $site_name = variable_get('site_name');
            $vars['footer_logo'] = l(theme('image', array('path' => drupal_get_path('theme', 'spartan') . "/logo-sm.png", 'alt' => "{$site_name} logo")), '', array("html" => TRUE, 'attributes' => array('class' => 'logo')));
            if (function_exists('defaultcontent_get_node') && ($node = defaultcontent_get_node("email_update"))) {
                $node = node_view($node);
                $vars['subscribe_form'] = $node['webform'];
            }
            //krumo($vars['footer_menu']);
            break;
    }
}
开发者ID:jeffanthony,项目名称:openpublic-drops-7,代码行数:53,代码来源:template.php


示例18: view

 /**
  * Displays the bean.
  */
 public function view($bean, $content, $view_mode = 'default', $langcode = NULL)
 {
     $query = new EntityFieldQuery();
     $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'article')->propertyCondition('status', 1)->propertyOrderBy('created', 'DESC')->range(0, $bean->settings['records_shown']);
     $result = $query->execute();
     if (empty($result)) {
         $content['nodes'] = array();
     } else {
         foreach ($result['node'] as $node) {
             $node = node_load($node->nid, $node->vid);
             $content['nodes'][$node->nid] = node_view($node, $bean->settings['node_view_mode']);
         }
     }
     $content['more_link']['#markup'] = theme('article_listing_more_link', array('text' => $bean->more_link['text'], 'path' => $bean->more_link['path']));
     return $content;
 }
开发者ID:undp-aprc,项目名称:undp-alm-old,代码行数:19,代码来源:ArticleListingBean.class.php


示例19: _tao_print_book_children

/**
 * Book printing recursion.
 */
function _tao_print_book_children($link, &$content, &$zomglimit, $limit = 500)
{
    if ($zomglimit < $limit) {
        $zomglimit++;
        if (!empty($link['link']['nid'])) {
            $node = node_load($link['link']['nid']);
            if ($node) {
                $content .= node_view($node);
            }
            if (!empty($link['below'])) {
                foreach ($link['below'] as $child) {
                    _tao_print_book_children($child, $content);
                }
            }
        }
    }
}
开发者ID:rmontero,项目名称:dla_ecommerce_site,代码行数:20,代码来源:template.php


示例20: testTwigDebugMarkup

 /**
  * Tests debug markup added to Twig template output.
  */
 function testTwigDebugMarkup()
 {
     $extension = twig_extension();
     theme_enable(array('test_theme'));
     \Drupal::config('system.theme')->set('default', 'test_theme')->save();
     // Enable debug, rebuild the service container, and clear all caches.
     $this->settingsSet('twig_debug', TRUE);
     $this->rebuildContainer();
     $this->resetAll();
     $cache = $this->container->get('theme.registry')->get();
     // Create array of Twig templates.
     $templates = drupal_find_theme_templates($cache, $extension, drupal_get_path('theme', 'test_theme'));
     $templates += drupal_find_theme_templates($cache, $extension, drupal_get_path('module', 'node'));
     // Create a node and test different features of the debug markup.
     $node = $this->drupalCreateNode();
     $build = node_view($node);
     $output = drupal_render($build);
     $this->assertTrue(strpos($output, '<!-- THEME DEBUG -->') !== FALSE, 'Twig debug markup found in theme output when debug is enabled.');
     $this->assertTrue(strpos($output, "CALL: _theme('node')") !== FALSE, 'Theme call information found.');
     $this->assertTrue(strpos($output, '* node--1--full' . $extension . PHP_EOL . '   x node--1' . $extension . PHP_EOL . '   * node--page--full' . $extension . PHP_EOL . '   * node--page' . $extension . PHP_EOL . '   * node--full' . $extension . PHP_EOL . '   * node' . $extension) !== FALSE, 'Suggested template files found in order and node ID specific template shown as current template.');
     $template_filename = $templates['node__1']['path'] . '/' . $templates['node__1']['template'] . $extension;
     $this->assertTrue(strpos($output, "BEGIN OUTPUT from '{$template_filename}'") !== FALSE, 'Full path to current template file found.');
     // Create another node and make sure the template suggestions shown in the
     // debug markup are correct.
     $node2 = $this->drupalCreateNode();
     $build = node_view($node2);
     $output = drupal_render($build);
     $this->assertTrue(strpos($output, '* node--2--full' . $extension . PHP_EOL . '   * node--2' . $extension . PHP_EOL . '   * node--page--full' . $extension . PHP_EOL . '   * node--page' . $extension . PHP_EOL . '   * node--full' . $extension . PHP_EOL . '   x node' . $extension) !== FALSE, 'Suggested template files found in order and base template shown as current template.');
     // Create another node and make sure the template suggestions shown in the
     // debug markup are correct.
     $node3 = $this->drupalCreateNode();
     $build = array('#theme' => 'node__foo__bar');
     $build += node_view($node3);
     $output = drupal_render($build);
     $this->assertTrue(strpos($output, "CALL: _theme('node__foo__bar')") !== FALSE, 'Theme call information found.');
     $this->assertTrue(strpos($output, '* node--foo--bar' . $extension . PHP_EOL . '   * node--foo' . $extension . PHP_EOL . '   * node--3--full' . $extension . PHP_EOL . '   * node--3' . $extension . PHP_EOL . '   * node--page--full' . $extension . PHP_EOL . '   * node--page' . $extension . PHP_EOL . '   * node--full' . $extension . PHP_EOL . '   x node' . $extension) !== FALSE, 'Suggested template files found in order and base template shown as current template.');
     // Disable debug, rebuild the service container, and clear all caches.
     $this->settingsSet('twig_debug', FALSE);
     $this->rebuildContainer();
     $this->resetAll();
     $build = node_view($node);
     $output = drupal_render($build);
     $this->assertFalse(strpos($output, '<!-- THEME DEBUG -->') !== FALSE, 'Twig debug markup not found in theme output when debug is disabled.');
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:47,代码来源:TwigDebugMarkupTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP noki函数代码示例发布时间:2022-05-15
下一篇:
PHP node_types_rebuild函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap