/** * Save link in search text (without the target attribute) * @param null|string $content * @return null|string */ public function generateSearchText($content) { $content = $this->_defaultData($content); $content['link'] = str_replace('internal://', '', $content['link'], $count); if ($count > 0) { $paths = Path::getById($content['link']); $content['link'] = $paths->exists ? $paths->name : ''; } return parent::generateSearchText($content['link']); }
/** * Display full edit page for gallery * @return \Illuminate\Contracts\View\View|string */ public function editPage() { $page = Page::preload($this->_block->getPageId()); if ($page->exists) { $paths = Path::getById($page->id); return View::make('coaster::pages.gallery', ['paths' => $paths, '_block' => $this->_block, 'can_delete' => Auth::action('gallery.delete', ['page_id' => $page->id]), 'can_edit_caption' => Auth::action('gallery.caption', ['page_id' => $page->id])]); } else { return 'page not found'; } }
/** * Get page name for search text instead of id * @param null|string $content * @return null */ public function generateSearchText($content) { return Path::getById($content)->name ?: null; }
/** * @param int|string $pageId * @param string $separator * @return Path */ public static function getFullPath($pageId, $separator = ' » ') { $pagePathData = Path::getById($pageId); $pagePathData->fullName = $pagePathData->fullName ? str_replace($pagePathData->separator, $separator, $pagePathData->fullName) : $pagePathData->fullName; return $pagePathData; }