Esempio n. 1
0
 /**
  * Sets the page owner on the homepage
  */
 function init()
 {
     \Idno\Core\Idno::site()->events()->addListener('page/get', function (\Idno\Core\Event $event) {
         if ($event->data()['page_class'] == 'Idno\\Pages\\Homepage') {
             if (\Idno\Entities\User::count(['admin' => true]) == 1) {
                 \Idno\Core\Idno::site()->currentPage()->setOwner(\Idno\Entities\User::getOne(['admin' => true]));
             }
         }
     });
 }
Esempio n. 2
0
 /**
  * Sets the page owner on the homepage
  */
 function init()
 {
     \Idno\Core\Idno::site()->events()->addListener('page/get', function (\Idno\Core\Event $event) {
         if ($event->data()['page_class'] == 'Idno\\Pages\\Homepage') {
             if (!empty(\Idno\Core\Idno::site()->config()->cherwell['profile_user'])) {
                 if ($profile_user = User::getByHandle(\Idno\Core\Idno::site()->config()->cherwell['profile_user'])) {
                     \Idno\Core\Idno::site()->currentPage()->setOwner($profile_user);
                 }
             }
             if (empty($profile_user)) {
                 if (\Idno\Entities\User::count(['admin' => true]) == 1) {
                     \Idno\Core\Idno::site()->currentPage()->setOwner(\Idno\Entities\User::getOne(['admin' => true]));
                 }
             }
         }
     });
     \Idno\Core\Idno::site()->addPageHandler('/admin/cherwell/?', 'Themes\\Cherwell\\Pages\\Admin');
 }