Strehler::Element::Role::Slugged - A role to manage element's slug
A slugged Strehler element provides an authomatic management of a slug (multilanguage or not). Slug can then be used to retrieve the element itself.
Default implementation that come with the role is the one used by Strehler::Element::Article but methods can be overridden for different behaviours.
A slugged element must include, in its database representation, a field named slug (VARCHAR), in the main table or in the table of multilanguage contents.
my $article = Strehler::Element::Article->get_by_slug('a-slug-suitable-for-web', $language)
Return 1 if the slug is multilanguage and comes from the multilanguage contents table.
Return the field, from the form, that will be used to make the slug.
Hook used by save_form method from Strehler::Element.
It takes the field with the name returned by to_slug from the POSTed form and create a slug from it using Strehler::Helpers slugify function.
Slug is guaranteed unique because, in any case, element ID is preferred to the slug string.
Function to retrieve elements using slug.
An element that implements this method returns true when slugged() function (Strehler::Element::Role::Configured) is called.
To install Strehler, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Strehler
CPAN shell
perl -MCPAN -e shell install Strehler
For more information on module installation, please visit the detailed CPAN module installation guide.