summaryrefslogtreecommitdiff
path: root/system/item
diff options
context:
space:
mode:
authorSteve <nilslice@gmail.com>2017-02-07 16:43:26 -0800
committerGitHub <noreply@github.com>2017-02-07 16:43:26 -0800
commita21c1485ec4ab973afc9a8e5dbf742d88ae32e84 (patch)
tree8a8d6beca70f2113cdebd433f80c321c9fa5d36f /system/item
parent28891b797bb24fde70df46fa2cd791af48526aae (diff)
parent7c2d4c7e609ff56541fd8787133d33d9f7951393 (diff)
Merge pull request #68 from ponzu-cms/ponzu-dev
[core] Documentation typo fixes, adding new Hookable methods: BeforeAccept & AfterAccept
Diffstat (limited to 'system/item')
-rw-r--r--system/item/item.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/system/item/item.go b/system/item/item.go
index e356c7c..f35d7f6 100644
--- a/system/item/item.go
+++ b/system/item/item.go
@@ -42,6 +42,9 @@ type Sortable interface {
// to the different lifecycles/events a struct may encounter. Item implements
// Hookable with no-ops so our user can override only whichever ones necessary.
type Hookable interface {
+ BeforeAccept(http.ResponseWriter, *http.Request) error
+ AfterAccept(http.ResponseWriter, *http.Request) error
+
BeforeSave(http.ResponseWriter, *http.Request) error
AfterSave(http.ResponseWriter, *http.Request) error
@@ -121,6 +124,16 @@ func (i Item) String() string {
return fmt.Sprintf("Item ID: %s", i.UniqueID())
}
+// BeforeAccept is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) BeforeAccept(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
+// AfterAccept is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) AfterAccept(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
// BeforeSave is a no-op to ensure structs which embed Item implement Hookable
func (i Item) BeforeSave(res http.ResponseWriter, req *http.Request) error {
return nil