Ntb\RestAPI\SlugableExtension
Extension for data objects which should be identifiable by a slug.
The data objects need a Title attribute or getTitle method, which will be used to generate the slug. If no title is
provided, the extension uses a generic combination with class name and object id.
- Author: Christian Blank <c.blank@notthatbad.net>
Synopsis
class SlugableExtension
extends DataExtension
{
- // members
- private static array $db = ;
- private static array $indexes = ;
- private static array $defaults = ;
- // methods
- public void onBeforeWrite()
- protected bool lookForExistingURLSegment()
- public string generateURLSegment()
- private void fallbackUrl()
Hierarchy
Extends
- DataExtension
Members
private
- $db
- $defaults
- $indexes
Methods
private
protected
- lookForExistingURLSegment() — Check if there is already a database entry with this url segment
public
- generateURLSegment() — Generate a URL segment based on the title provided.
- onBeforeWrite() — Set URLSegment to be unique on write