Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Updating my slug
How can I get my slug to update?
Is this bad practice in general?
I have this in my model:
'Orm\Observer_Slug' => array(
'events' => array('before_insert', 'before_update'),
'source' => array('first', 'middle', 'last', 'suffix'), // property used to base the slug on, may also be array of properties
'property' => 'slug', // property to set the slug on when empty
I dind't understand very well, you want to update your slug (editing the model) or you want the slag after you have updated your model?
I mean, if I edit a record, I'd like the slug of that record to update as well.
So in the above, a first, middle, last and suffix fields are concatenated to create a slug.
If I change one of those fields, I'd like the slug to be properly updated too.
I guess I failed to mention, Id like it to be updated using the observer.
If I look at the observer code, I don't see any reason why it wouldn't update the slug.
before_update() will check if one of the source fields has changed, and if so, it will call before_insert() to create a new slug and store it in the defined property.
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion