Plug-in Events of JoomFunding will let you extend the extension and developing own plug-ins.
Read more about plug-ins development here: http://docs.joomla.org/Plugin_Developer_Overview
1) Content Events
Content events are triggered during the content creation process. The majority of these events are called in views, components and modules. This list gives a brief description of each event, what their parameters are, and some examples of their use in core plugins.
onContentValidate
-
Description
This event is used to validate data during the process of creating a project. This event is invoked on steps "Basic", "Funding" and "Story".
-
Parameters
context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_joomfunding.basic). Use this to check whether you are in the desired context for the plugin.&data - A reference to the data that is being sent by the user.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
Returns an associative array.
array(
"success" => true
);
array(
"success" => false,
"message" => "Invalid title."
); -
Example
Content - Joomfunding Validator
-
Used in files
components/com_joomfunding/controllers/project.php
components/com_joomfunding/controllers/funding.php
components/com_joomfunding/controllers/story.php
onContentValidateAfterSave
-
Description
This event is used to validate data during the process of creating a project. This event is invoked on steps "Basic", "Funding" and "Story".
-
Parameters
context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_joomfunding.basic). Use this to check whether you are in the desired context for the plugin.
&item - A reference to the project object.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
Returns an associative array.
array(
"success" => true
);
array(
"success" => false,
"message" => "Invalid title."
); -
Example
Content - Joomfunding Validator
-
Used in files
components/com_joomfunding/controllers/story.php
onContentValidateChangeState
-
Description
The system uses this event to validate project data when someone decide to change project state. It is used only on front-end and validates the project data when someone launch a project.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_joomfunding.projects.changestate). Use this to check whether you are in the desired context for the plugin.
&item - A reference to the project object.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
Returns an associative array.
array(
"success" => true
);
array(
"success" => false,
"message" => "Invalid title."
); -
Example
Content - Joomfunding Validator
-
Used in files
components/com_joomfunding/controllers/projects.php
onContentAfterSave
-
Description
This is an event that is called after the content is saved into the database. Even though article object is passed by reference, changes will not be saved since storing data into database phase is past. An example use case would be redirecting user to the appropriate place after saving.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_joomfunding.project). Use this to check whether you are in the desired context for the plugin.
&item - A reference to the JTableProject object that is being saved which holds the project data.
isNew - A boolean which is set to true if the content is about to be created. -
Return Value
Returns TRUE on success, FALSE on failure and NULL to omit the result.
-
Example
Content - Joomfunding Admin Mail
-
Used in files
components/com_joomfunding/models/project.php
onContentChangeState
-
Description
This is an event that is called after content has its state change (e.g. Launched to Stopped ).
-
Parameters
context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_joomfunding.project). Use this to check whether you are in the desired context for the plugin.
ids - An array of primary key ids of the content that has changed state.
state - The value of the state that the content has been changed to. -
Return Value
Returns TRUE on success, FALSE on failure and NULL to omit the result.
-
Example
Content - Joomfunding Admin Mail
-
Used in files
components/com_joomfunding/models/projectitem.php
administrator/components/com_joomfunding/models/project.php
onContentBeforeDisplay
-
Description
This is a request for information that should be placed immediately before the generated content. For views that generate HTML, this might include the use of styles that are specified as part of the content or related parameters. Although parameters are passed by reference, this is not the event to modify project data.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name and view - or name of module (e.g. com_crowdfinding.details). Use this to check whether you are in the desired context for the plugin.
&article- The project that is being rendered by the view.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
String. Returned value from this event will be displayed on details page the media ( picture and video ).
-
Example
Content - Joomfunding Nav
-
Used in files
components/com_joomfunding/views/details/view.html.php
onContentAfterDisplayMedia
-
Description
This is a request for information that should be placed immediately after the media ( picture or video ) on details page. For views that generate HTML, this might include the use of styles that are specified as part of the content or related parameters. Although parameters are passed by reference, this is not the event to modify project data.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name and view - or name of module (e.g. com_crowdfinding.details). Use this to check whether you are in the desired context for the plugin.
&article - The project that is being rendered by the view.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
String. Returned value from this event will be displayed on details page after the media ( picture and video ).
-
Example
Content - Joomfunding Share
-
Used in files
components/com_joomfunding/views/details/view.html.php
onContentAfterDisplay
-
Description
This is a request for information that should be placed immediately after the generated content. For views that generate HTML, this might include the closure of styles that are specified as part of the content or related parameters. Although parameters are passed by reference, this is not the event to modify project data.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name and view - or name of module (e.g. com_crowdfinding.details). Use this to check whether you are in the desired context for the plugin.
&article - The project that is being rendered by the view.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
String. Returned value from this event will be displayed on details page and on payment wizard, step "Share" (last step).
-
Example
Content - Joomfunding Images
-
Used in files
components/com_joomfunding/views/details/view.html.php
components/com_joomfunding/views/backing/view.html.php
2) Payment Events
Joomfunding Payment events are triggered during the payment process. They are used for preparing payment plugins and processing transactions.
onPaymentExtras
-
Description
This is a request for information that should be placed on step 2 of the payment wizard.This generates an HTML and might include the closure of styles that are specified as part of the content or related parameters.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_joomfunding.payment.step2). Use this to check whether you are in the desired context for the plugin.
&item - A reference to the project object.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
String. Returned value from this event will be displayed on step 2 of the payment wizard.
-
Example
JoomfundingPayment - Login
-
Used in files
components/com_joomfunding/views/backing/view.html.php
onProjectPayment
-
Description
This is a request for information that should be placed on the payment wizard, step "Payment". This generates an HTML code providing functionality for processing payments.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_joomfunding.payment). Use this to check whether you are in the desired context for the plugin.
&item - A reference to the project object.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
String. Returned value from this event will be displayed on step "Payment" of the payment wizard.
-
Example
JoomfundingPayment - PayPal
-
Used in files
components/com_joomfunding/views/backing/view.html.php
onPaymentAuthorize
-
Description
This event authorize the possibility to make payment. This event will be triggered when someone continue to "step 2" and the system uses "Four Step" payment wizard.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_joomfunding.payment.authorize). Use this to check whether you are in the desired context for the plugin.
&item - A reference to the project object.
¶ms - A reference to an object that provides parameters of the component.
&user - A reference to a user object ( JUser ). -
Return Value
Returns TRUE on success, FALSE on failure and NULL to omit the result.
-
Example
JoomfundingPayment - Login
-
Used in files
components/com_joomfunding/controllers/backing.php
onBeforePaymentAuthorize
-
Description
This event authorize the possibility to make payment on "step 2" of the payment wizard.
If a plug-in returns content, the system will not evoke the event "onProjectPayment". It will display that content instead payment gateways, that should be initialized by "onProjectPayment". -
Parameters
context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_joomfunding.before.payment.authorize). Use this to check whether you are in the desired context for the plugin.
&item - A reference to the project object.
&amount - A reference to the object Joomfunding\Amount.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
Returns STRING on success and NULL to omit the result.
-
Example
JoomfundingPayment - Fraud Prevention
-
Used in files
plugins/joomfundingpayment/fraudprevention/fraudprevention.php
onPaymentNotify
-
Description
This event will be invoked when the system receives notification data from a payment gateway. That event should process the transaction.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name, the string "notify" and the name of the payment service (e.g. com_joomfunding.notify.paypal). Use this to check whether you are in the desired context for the plugin.
params - An object that provides parameters of the component. -
Return Value
This event returns an object that contains the name and alias of the payment gateway. It also contains the following objects - project, reward, transaction and payment session.
$paymentResult = new stdClass;
{ "project" => {object}, "reward" => {object}, "transaction" => {object},
"paymentSession" => {object}, "serviceProvider" => "PayPal", "serviceAlias" => "paypal",
"redirectUrl" => "",
"message" => "",
"triggerEvents" => false }; -
Example
JoomfundingPayment - PayPal
JoomfundingPayment -Stripe Connect -
Used in files
components/com_joomfunding/controllers/notifier.raw.php
components/com_joomfunding/controllers/payments.php
onAfterPaymentNotify
-
Description
This event will be triggered when the system completes with the processing of transaction. This will be invoked after the event onPaymentNotify.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name, the string "notify" and the name of the payment service (e.g. com_joomfunding.payments.checkout.stripe). Use this to check whether you are in the desired context for the plugin.
paymentResult - An object that contains data returned by the event onPaymentNotify.
params - An object that provides parameters of the component. -
Return Value
None. It does not return value.
-
Example
JoomfundingPayment - PayPal
JoomfundingPayment -Stripe Connect -
Used in files
components/com_joomfunding/controllers/notifier.raw.php
components/com_joomfunding/controllers/payments.php
onAfterPayment
-
Description
This event will be triggered when the system completes with the processing of transaction. This will be invoked after the event onPaymentNotifyNotify.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name, the string "notify" and the name of the payment service (e.g. com_joomfunding.notify.paypal). Use this to check whether you are in the desired context for the plugin.
paymentResult - An object that contains data returned by the event onPaymentNotify.
params - An object that provides parameters of the component. -
Return Value
None. It does not return value.
-
Example
JoomfundingPayment - PayPal
JoomfundingPayment -Stripe Connect -
Used in files
components/com_joomfunding/controllers/notifier.raw.php
components/com_joomfunding/controllers/payments.php
onPaymentsCheckout
-
Description
This event is invoked when a user makes a payment. It is used from payment services which provide preapproved payments. This event will create a preapproved transaction record.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name, the string "payments.checkout" and the name of the payment service (e.g. com_joomfunding.payments.checkout.paypal). Use this to check whether you are in the desired context for the plugin.
&item - A reference to the project object.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
Returns an associative array.
array(
"redirect_url" => "..." // A URL where the system should redirect the user when payment processing completes.
); -
Example
JoomfundingPayment - PayPal Adaptive
-
Used in files
components/com_joomfunding/controllers/payments.php
onPaymentsDoCheckout
-
Description
This event will be executed when the system has to process preapproved payment. It is used from payment services which provide preapproved payments. This event will register a preapproved transaction in the payment service.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name, the string "payments.docheckout" and the name of the payment service (e.g. com_joomfunding.payments.docheckout.paypal). Use this to check whether you are in the desired context for the plugin.
&item - A reference to the project object.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
Returns an associative array.
array(
"redirect_url" => "..." // A URL where the system should redirect the user when payment processing completes.
); -
Example
JoomfundingPayment - PayPal Express
-
Used in files
components/com_joomfunding/controllers/payments.php
onPaymentsPreparePayment
-
Description
This event is invoked to provide additional data to a plug-in. That will be received by AJAX request and will be used from users to continue with their payment.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name, the string "preparepayment" and the name of the payment service (e.g. com_joomfunding.preparepayment.mollieideal). Use this to check whether you are in the desired context for the plugin.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
Returns an associative array.
array(
"success" true, // TRUE or FALSE
"title" => "The data was...", // A message to the user
"data" => array(
"url" => "..." // A URL where the system should redirect the user when payment processing completes.
)
); -
Example
JoomfundingPayment - Mollie iDEAL
-
Used in files
components/com_joomfunding/controllers/payments.raw.php
onTransactionChangeState
-
Description
This event is triggered when the administrator changes the state of a transaction. It is only invoked from back-end.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name the name of the view (e.g.com_joomfunding.transaction). Use this to check whether you are in the desired context for the plugin.
&item - A reference to the project object.
oldStatus - A value of the old transaction state.
newStatus - A value of the old transaction state. -
Return Value
None. This event does not return any data.
-
Example
JoomfundingPayment Plugin class
-
Used in files
administrator/components/com_joomfunding/models/transaction.php
onPaymentsCapture
-
Description
This event is triggered when the administrator decides to process a preapproved transaction. This event should make a request to payment services to capture preapproved amount. It is invoked only from back-end by the administrator.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name, the string "payments.capture" and the name of the payment service (e.g. com_joomfunding.payments.capture.paypal). Use this to check whether you are in the desired context for the plugin.
&item - A reference to the project object.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
Returns an associative array.
array(
"message" => "The transaction was...", // A message to the user
"type" => "message" // The type of the message - error or message.
); -
Example
JoomfundingPayment - PayPal Adaptive
-
Used in files
administrator/components/com_joomfunding/controllers/payments.php
onPaymentsVoid
-
Description
This event is triggered when the administrator decides to cancel a preapproved transaction. It is invoked only from back-end by the administrator.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name, the string "payments.capture" and the name of the payment service (e.g. com_joomfunding.payments.capture.paypal). Use this to check whether you are in the desired context for the plugin.
&item - A reference to the project object.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
Returns an associative array.
array(
"message" => "The transaction was...", // A message to the user
"type" => "message" // The type of the message - error or message.
); -
Example
JoomfundingPayment - PayPal Adaptive
-
Used in files
administrator/components/com_joomfunding/controllers/payments.php
3) Display Events
Joomfunding events are triggered on step five of the project wizard. This events provides additional features managed by third-party extensions.
onExtrasDisplay
-
Description
This is a request for a code that should be included on step five of the project wizard. For views that generate HTML, this might include the closure of styles that are specified as part of the content or related parameters. Although parameters are passed by reference, this is not the event to modify project data.
-
Parameters
context - The context of the content being passed to the plugin - this is the component name, view and additional context phrase (e.g. com_joomfunding.project.extras). Use this to check whether you are in the desired context for the plugin.
&item - The project that is being rendered by the view.
¶ms - A reference to an object that provides parameters of the component. -
Return Value
String. Returned value from this event will be displayed on project wizard, step "Extras" (fifth step).
-
Example
Some of the premium extensions (Joomfunding Files, Joomfunding Partners, Joomfunding Finance) uses this event. You will find examples in folder "plugins/joomfunding/files".
-
Used in files
components/com_joomfunding/views/project/view.html.php
4) Observer Events
These events are triggered by objects before or after specific action.
onBeforeProcessTransaction
-
Description
This event will be triggered before system process transaction by Transaction Manager.
-
Parameters
context - The context of the content being passed to the observer - this is the component name, view and additional context phrase (e.g. com_joomfunding.transaction.process). Use this to check whether you are in the desired context for the observer.
transaction - An object of transaction record.
options - An array with options used in the observer event. -
Return Value
It does not return any value.
-
Example
The observer that will be handled by Transaction Manager in payment plugins.
You will find examples in the following file.
libraries/Joomfunding/Observer/Transaction/TransactionObserver.php
plugins/joomfundingpayment/paypal/paypal.php -
Used in files
libraries/Joomfunding/Transaction/TransactionManager.php
onAfterProcessTransaction
-
Description
This event will be triggered when system process a transaction by Transaction Manager.
-
Parameters
context - The context of the content being passed to the observer - this is the component name, view and additional context phrase (e.g. com_joomfunding.transaction.process). Use this to check whether you are in the desired context for the observer.
transaction - An object of transaction record.
options - An array with options used in the observer event. -
Return Value
It does not return any value.
-
Example
The observer that will be handled by Transaction Manager in payment plugins.
You will find examples in the following file.
libraries/Joomfunding/Observer/Transaction/TransactionObserver.php
plugins/joomfundingpayment/paypal/paypal.php -
Used in files
libraries/Joomfunding/Transaction/TransactionManager.php