This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Is there a function or method which allows us to gather all Pages as an object and their attributes?
All pages? Are you talking about octobers cms pages?
I've not done this... but in the menu lists plugin (http://octobercms.com/plugin/flynsarmy-menu) he uses them in a DropDownHelper.php and uses use Cms\Classes\Page
like so:
use Cms\Classes\Page as Pg;
use Cms\Classes\Partial as Prtl;
use Cms\Classes\Theme;
class DropDownHelper
{
use \October\Rain\Support\Traits\Singleton;
protected $pages = [];
protected $partials = [];
public function pages()
{
if ( !$this->pages )
{
$theme = Theme::getEditTheme();
$pages = Pg::listInTheme($theme, true);
$options = [];
foreach ( $pages as $page )
$options[$page->baseFileName] = $page->title . ' ('.$page->url.')';
asort($options);
$this->pages = $options;
}
So maybe mess with listInTheme() in use Cms\Classes\Page
(or its parent).
I find it a little frustrating that there is such limited documentation on how to build menuing systems outside of using pre-made plugins. There really does not appear to be a clear or definitive way to do anything within this platform without relying heavily on someone else's work.
@Droach5875216, thats because its so flexible and you can do whatever you want. You can simply hardcode the menu's in if you want. Or use the menu plugins as examples on how to build your own system.
1-5 of 5