コード例 #1
0
 /**
  * @param FrontendPage|int $page
  * @param string               $part
  *
  * @return string
  */
 public static function get($page, $part)
 {
     $html = null;
     $pageId = $page instanceof FrontendPage ? $page->getId() : (int) $page;
     $parts = static::loadPartsByPageId($pageId);
     if (empty($parts[$pageId][$part])) {
         return;
     }
     return array_get($parts, implode('.', [$pageId, $part, 'content_html']));
 }
コード例 #2
0
 /**
  * @param FrontendPage|integer $page
  * @param string $part
  * @return string
  */
 public static function get($page, $part)
 {
     $html = null;
     $pageId = $page instanceof FrontendPage ? $page->getId() : (int) $page;
     static::loadPartsbyPageId($pageId);
     if (empty(static::$cached[$pageId][$part])) {
         return null;
     }
     if (($part = static::$cached[$pageId][$part]) instanceof PagePartModel) {
         $html = $part->content_html;
     } else {
         if (($view = static::$cached[$pageId][$part]) instanceof View) {
             $html = (string) $view;
         }
     }
     return $html;
 }