Each of my entry types have their own template.
The url is something like:
/foo/{entryTypeHandle}
And the route is:
'foo/(?P<routesEntryTypeHandle>[-\w]+)' => 'bar.html'
In the template I can get the section the entry type is in:
{% set section = craft.sections.getSectionById(5) %}
And I can get ALL the entry types:
{% set entryTypes = section.getEntryTypes() %}
And I can get all the entries of that entry type:
{% set entries = craft.entries.section(section).type(routesEntryTypeHandle) %}
But I can't seem to get the entry type's name.
In the Sections Service there's a method called getEntryTypesByHandle
but that's not available in the model.
I could get the entry type name from the entries
, but that relies on there actually being results, which isn't assured.
{{ entries.first.type.name }}
I must be missing an easier way. Anyone?