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


PHP NodeInterface::getEntityType方法代码示例

本文整理汇总了PHP中Drupal\node\NodeInterface::getEntityType方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeInterface::getEntityType方法的具体用法?PHP NodeInterface::getEntityType怎么用?PHP NodeInterface::getEntityType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\node\NodeInterface的用法示例。


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

示例1: bookExportHtml

 /**
  * Generates HTML for export when invoked by book_export().
  *
  * The given node is embedded to its absolute depth in a top level section. For
  * example, a child node with depth 2 in the hierarchy is contained in
  * (otherwise empty) <div> elements corresponding to depth 0 and depth 1.
  * This is intended to support WYSIWYG output - e.g., level 3 sections always
  * look like level 3 sections, no matter their depth relative to the node
  * selected to be exported as printer-friendly HTML.
  *
  * @param \Drupal\node\NodeInterface $node
  *   The node to export.
  *
  * @throws \Exception
  *   Thrown when the node was not attached to a book.
  *
  * @return array
  *   A render array representing the HTML for a node and its children in the
  *   book hierarchy.
  */
 public function bookExportHtml(NodeInterface $node)
 {
     if (!isset($node->book)) {
         throw new \Exception();
     }
     $tree = $this->bookManager->bookSubtreeData($node->book);
     $contents = $this->exportTraverse($tree, array($this, 'bookNodeExport'));
     return array('#theme' => 'book_export_html', '#title' => $node->label(), '#contents' => $contents, '#depth' => $node->book['depth'], '#cache' => ['tags' => $node->getEntityType()->getListCacheTags()]);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:29,代码来源:BookExport.php

示例2: _getRevisionIds

 /**
  * Gets a list of node revision IDs for a specific node.
  *
  * @param \Drupal\node\NodeInterface
  *   The node entity.
  * @param \Drupal\node\NodeStorageInterface $node_storage
  *   The node storage handler.
  *
  * @return int[]
  *   Node revision IDs (in descending order).
  */
 protected function _getRevisionIds(NodeInterface $node, NodeStorageInterface $node_storage)
 {
     $result = $node_storage->getQuery()->allRevisions()->condition($node->getEntityType()->getKey('id'), $node->id())->sort($node->getEntityType()->getKey('revision'), 'DESC')->pager(50)->execute();
     return array_keys($result);
 }
开发者ID:DrupalCamp-NYC,项目名称:dcnyc16,代码行数:16,代码来源:NodeController.php


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