function getParentPageHandle() { if (func_num_args() == 0) { return array('description' => t('Handle of the parent page'), 'customonclick' => ExtendedContentParseInput::getPageInput()); } $page = Page::getByID(func_get_arg(0)); $parentPage = Page::getByID($page->getCollectionParentID()); return $parentPage->getCollectionHandle(); }
function getGoogleLikeCustomPageButton() { if (func_num_args() == 0) { return array('description' => t('Get google +1 button for custom page'), 'customonclick' => ExtendedContentParseInput::getPageInput()); } global $c; $page = Page::getByID(func_get_arg(0)); $nh = Loader::helper('navigation'); $cpl = $nh->getCollectionURL($page); $language = 'en'; $package = Package::getByHandle('multilingual'); if ($package) { $lh = Loader::helper('section', 'multilingual'); $language = $lh->getLanguage(); } else { if (defined('LOCALE')) { $language = substr(LOCALE, 0, strpos(LOCALE, '_')); } } return ' <g:plusone size="medium" annotation="inline" href="' . $cpl . '"></g:plusone> <script type="text/javascript"> window.___gcfg = {lang: \'' . $language . '\'}; (function() { var po = document.createElement(\'script\'); po.type = \'text/javascript\'; po.async = true; po.src = \'https://apis.google.com/js/plusone.js\'; var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s); })(); </script> '; }