Is there an easy way to check what the current page section type is, within a plugin?
I wonder if I'm overlooking a little function that simply returns: "single", "channel", "entry", etc...?
Thank you Aevlan, this was the approach I took originally. I've been struggling to determine wether the user is currently on the root of a channel/structure, or if they are on an entry page.
This is how I can determine "single", "channel" or "structure".
$element = craft()->urlManager->getMatchedElement(); $element_exists = $element && $element->getElementType() == ElementType::Entry; $currentPageType = $element->section->type;
The reason I need to know this, is so I can perform some checks before I add certain navigation throughout the site. To help with my specific issue, I will use "hasDescendants()" or check the segment counts.
Thanks again. Mark