jonom / silverstripe-betternavigator

Front-end utility menu for SilverStripe websites featuring administration and development tools
60 stars 31 forks source link

Conflicting template variables #8

Closed jedateach closed 9 years ago

jedateach commented 10 years ago

I was recently working on a project that would break with better navigator because I had a member controller action. This is also a variable that the better navigator looks for in the global template variable space.

Can I suggest that the data rendered here be wrapped inside another ArrayData variable like BetterNavigatorData? The template will need to be adjusted accordingly.

This will ensure that BetterNavigator doesn't pick up controller/model functions/fields that users have defined.

I can't imagine this will break backwards compatibility because the BetterNavigator template is the one looking for these variables.

jedateach commented 10 years ago

Or better yet - don't customise $this->owner.

jonom commented 10 years ago

Hi @jedateach, I'd like the current page to be available in the BetterNavigator.ss template so that developers can override the template and have access to methods from the current page controller. It seems like an easy way to allow developers to customise the buttons on a per-page-type basis. So I'd prefer to go with your first suggestion unless there's another reason not to customise $this->owner?

jonom commented 10 years ago

@jedateach did you have any additional thoughts on this?