コード例 #1
0
ファイル: EntityFindSomething.php プロジェクト: radicalsuz/fe
 /**
  * @param string $path
  * @param array $item
  * @return array
  */
 protected function find($path, $item)
 {
     if (FALSE === ($entity = crumbs_Util::itemExtractEntity($item, $this->entityType))) {
         return;
     }
     if ('user' === $this->entityType) {
         return $this->userFind($entity);
     } else {
         return $this->entityFind($entity);
     }
 }
コード例 #2
0
ファイル: ListOfNews.php プロジェクト: radicalsuz/fe
 /**
  * Set news/(year)/(month)/(day) as the parent for a node.
  * You can use the weights config at Admin > Structure > Crumbs to specify
  * which node types this should apply to.
  *
  * @param string $path
  * @param array $item
  *   The loaded router item for $path.
  *
  * @return string[]|NULL
  *   Candidates for the parent path, or NULL.
  */
 function findParent__node_x($path, $item)
 {
     if (FALSE === ($node = crumbs_Util::itemExtractEntity($item, 'node', 1))) {
         return;
     }
     if (!empty($node->created)) {
         list($year, $month, $day) = explode('-', date('Y-m-d', $node->created));
         $path = "news/{$year}/{$month}/{$day}";
         return array($node->type => $path);
     }
 }