I am trying to understand if it is possible to do a hook on an entry save without creating a plugin.

This is what I would like to happen: - In my entry, I have some address fields (street, city, province...). - I would like to take those info and go grab a lat and long from Google maps and save it with the entry. The lat and long fields are also available in the entry if people want to fill them or modify them.

I was doing all this in Wordpress with custom post types, but I'm trying to convert it to Craft.

Is it possible or do I have to create a plugin to do it?

1 Answer 1


I think the short answer is yes, you do need a plugin to listen for events or tie into Craft's hooks.

Luckily if that is all you need to do you can probably get away with writing a plugin that is only the singular plugin class file, you may not need any other plugin classes (models/records/etc).

It seems as if you want to listen for onSaveEntry.

  • That's what I thought, and I was reading exactly where your link sent me a few minutes ago. I'll try my hand at creating a simple plugin then. Apr 15, 2015 at 15:34
  • In making my own I found reading the source for existing plugins really helpful. Pixel and Tonic's github profile has some, and looking through the community plugins some (not many) of them are open-source. Good luck! Apr 15, 2015 at 15:36
  • Have a look at the BusinessLogic plugin, which provides a really basic plugin template complete with service, controller, and variables file and inline documentation. Apr 15, 2015 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.