UseMuffin / Slug

Slugging for CakePHP
MIT License
35 stars 14 forks source link

Slug not created when editing a record #8

Closed vaughany closed 9 years ago

vaughany commented 9 years ago

I have an existing table I have been using for a while and contains records. I have added the Slug plugin appropriately, keeping all the defaults.

Slugs are created for newly added records, but are not created when an existing record is edited.

I appreciate this might not be desired behaviour (I can imagine slugs changing could upset a lot of people) but is it possible to create a slug when editing an existing record only when the 'slug' field is empty? This way, existing slugs will not be automatically changed when other fields in the record are edited (although this could be configurable behaviour?) but slugs will be created for empty fields.

bravo-kernel commented 9 years ago

Just my two cents but I think we should stick to creating slug (only) for newly added records:

vaughany commented 9 years ago

Your first point: yes, absolutely that could be done. I'm doing it myself now.

Your second point: I wasn't aware of that as a use-case, as when I've used slugs, I've always slugged everything.

It would be nice to have the option to populate empty fields with slugs as it would save some work, however I can understand the desire not to. Had I had this plugin installed from day one, it wouldn't be a concern. :)

ADmad commented 9 years ago

I think having an option to regenerate slug when editing records would be nice.

@vaughany Would you like to submit a patch with required changes?

vaughany commented 9 years ago

Sorry, totally missed this. I'm not sure I could have, to be honest, I am not yet competent enough with Cake's innards.