コード例 #1
0
 /**
  * Returns the block's descendants.
  *
  * @param int|null $dist
  * @return ElementCriteriaModel
  */
 public function getDescendants($dist = null)
 {
     // If the request is in Live Preview mode, use the Neo-extended criteria model, which supports Live Preview mode
     if (craft()->neo->isPreviewMode()) {
         if (!isset($this->_liveCriteria['descendants'])) {
             $criteria = craft()->neo->getCriteria();
             $criteria->setAllElements($this->_allElements);
             $criteria->descendantOf = $this;
             $this->_liveCriteria['descendants'] = $criteria;
         }
         if ($dist) {
             return $this->_liveCriteria['descendants']->descendantDist($dist);
         }
         return $this->_liveCriteria['descendants'];
     }
     return parent::getDescendants($dist);
 }