Skip to content

Have SlugHandler look up slugs automatically #8

Description

@NightJar

Investigation issue.

If possible, it would be cool to have the SlugHandler try to pick default settings for itself if none are provided.
That is to say if no constructor argument is passed, nor is there any slug_trails config defined on the class it is applied to (or the data model thereof), perhaps it could look up for the settings in the extensions section for what relationship the Slug extension is applied to, and how it manages that. Assumptions would have to be made, or perhaps a default path could be generated? Unsure. Want to be careful of information leakage (e.g. exposing internal names of objects, which probably isn't that sensitive, but should at least be a consideration).

In the very least there should be a 404 thrown if no $slime is found, instead of generating an error:

[Warning] array_key_exists() expects parameter 2 to be array, null given
GET /some-page/some-slug
Line 103 in .../vendor/nightjar/ss-slug/src/SlugHandler.php

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions