Jump to content

More Events


Blesta Addons

Recommended Posts

we need more event to be implemented in blesta like :

Client Edit Profile

Client Change Password

Client Delete (Before & After action )

Client Profile Tab Fields (dropdown menu)

Contact Add | Contact Edit | Contact Delete

Client Dashboard Page Load

Client Pay Method

Client Pay Confirm

Admin Dashboard Page Load

Daily CronJob (Before & After action )

Invoice Payment Reminder

Accept Order

Delete Order

Pending Order

Order Checkout

Shopping Cart Checkout Page

Show Cart Page

Module Create (Before & After action )

Module Suspend (Before & After action )

Module unSuspend (Before & After action )

Module terminate (Before & After action )

Admin/Client Services Tab Fields (rendered)

upload Files action

Ticket Plugin :

Add - reply - close tickets

Download Manager Plugin

Download (Before & After action )

order plugin

every step event (before/after)

Link to comment
Share on other sites

  • 5 weeks later...

+1 More , and we need to add the fallowing event , this specially if we want to pass our js/css/php into the global structure file :

admin_header

admin_on_body_start

admin_on_body_load

admin_footer

client_header

client_on_body_start

client_on_body_load

client_footer

this will solve the probleme for changing the structure.pdt file , like the PauloV method .

Link to comment
Share on other sites

+1 More , and we need to add the fallowing event , this specially if we want to pass our js/css/php into the global structure file :

admin_header

admin_on_body_start

admin_on_body_load

admin_footer

client_header

client_on_body_start

client_on_body_load

client_footer

this will solve the probleme for changing the structure.pdt file , like the PauloV method .

I am not sure if these events really fit the same request. It seems like you are looking for display hooks rather then triggered events.

Link to comment
Share on other sites

Blesta didn't support hooks now , our only solution is events .

You may want to request a hook system then.  

Those events just don't make sense (at least to me). Having the webpage load shouldn't trigger events.  Actions that are happening should trigger events.  (My wording on this is horrible as it makes sense in my head but I can't seem to put what I am thinking to words) 

Link to comment
Share on other sites

See the updated CORE-1371. With this event, plugins are able to inject arbitrary markup into the head, top of the body, and bottom of the body, as well as set variables into the structure that could be used in conjunction with changes to the structure file.

 


You may want to request a hook system then.  

Those events just don't make sense (at least to me). Having the webpage load shouldn't trigger events.

 

There's really no difference. A hook is simply a poor man's event. By the way, there's already an event that is triggered on every page load: Appcontroller.preAction. CORE-1371 improves on that event.

Link to comment
Share on other sites

See the updated CORE-1371. With this event, plugins are able to inject arbitrary markup into the head, top of the body, and bottom of the body, as well as set variables into the structure that could be used in conjunction with changes to the structure file.

 

 

 

There's really no difference. A hook is simply a poor man's event. By the way, there's already an event that is triggered on every page load: Appcontroller.preAction. CORE-1371 improves on that event.

 

 

as you told , no matter the name who is , who matter is the function that do this :)

 

as i see it putted to 3.3.0 ... so i think is matter of days .

 

with Appcontroller.preAction i think i have found a bug , but i will do more test to confirm it .

Link to comment
Share on other sites

See the updated CORE-1371. With this event, plugins are able to inject arbitrary markup into the head, top of the body, and bottom of the body, as well as set variables into the structure that could be used in conjunction with changes to the structure file.

 

please a sample code to handle the Appcontroller.structure , is this code correct

$params = $event->getParams(); // get any set data previoslly ,  to not overide other plugin data 
  $params['controller'] += "ClientMain"; // this is the controller file name client_main.php
  $params['action'] += "MyFunction"; // a function inside the appcontroller file set in $params['controller']
  $params['portal'] += "client"; // injest the markup in client side structure 

  $event->setParams($params); // send array of new params with old and new data .

and how the views file should be to set data in head or body ?

Link to comment
Share on other sites

Docs here.

$return = $event->getReturnVal();

if (!array_key_exists("head", $return))
    $return['head'] = null;
if (!array_key_exists("body_start", $return))
    $return['body_start'] = null;
if (!array_key_exists("body_end", $return))
    $return['body_end'] = null;

$return['head'] .= "<script>alert('head');</script>"
$return['body_start'] .= "<p>Set at top of body</p>";
$return['body_end'] .= "<p>Set at bottom of body</p>";

$event->setReturnVal($return);

But now that I think about it more, I'm thinking maybe each section should be an array. So instead you could just do:
 

$return = $event->getReturnVal();

$return['head'][] "<script>alert('head');</script>"
$return['body_start'][] "<p>Set at top of body</p>";
$return['body_end'][] "<p>Set at bottom of body</p>";

$event->setReturnVal($return);

Which is easier to use, and a little harder to accidentally overwrite other plugin's return values. What do you think?

Link to comment
Share on other sites

Docs here.

$return = $event->getReturnVal();

if (!array_key_exists("head", $return))
    $return['head'] = null;
if (!array_key_exists("body_start", $return))
    $return['body_start'] = null;
if (!array_key_exists("body_end", $return))
    $return['body_end'] = null;

$return['head'] .= "<script>alert('head');</script>"
$return['body_start'] .= "<p>Set at top of body</p>";
$return['body_end'] .= "<p>Set at bottom of body</p>";

$event->setReturnVal($return);

But now that I think about it more, I'm thinking maybe each section should be an array. So instead you could just do:

 

$return = $event->getReturnVal();

$return['head'][] "<script>alert('head');</script>"
$return['body_start'][] "<p>Set at top of body</p>";
$return['body_end'][] "<p>Set at bottom of body</p>";

$event->setReturnVal($return);

Which is easier to use, and a little harder to accidentally overwrite other plugin's return values. What do you think?

 

Let me try this weekend with some freezing plugin , and to see it live in with 2 or 3 plugins .

 

Edit  : we can use the controller/view files instead of direct putting data in the function ?

Link to comment
Share on other sites

 

Edit  : we can use the controller/view files instead of direct putting data in the function ?

 

Yes. Use file_get_contents(), or if javascript or CSS: "<script src="path/to/the/file.js"></script>"

 

Any thoughts on using array instead of string?

$return = $event->getReturnVal();

$return['head'][] "<script>alert('head');</script>"
$return['body_start'][] "<p>Set at top of body</p>";
$return['body_end'][] "<p>Set at bottom of body</p>";

$event->setReturnVal($return);

The more I think about it, the more I like using the array method (above).

Link to comment
Share on other sites

Hello Cody .

from my side , array is better , but take note ... we have begin coding of our new plugins , so all now in string mode .

changing to array shold be now and release the B2 in the same day, or we will lose time in coding for something will change .

what i really preffer is a array with

text => html_output

order => 1 // make it from 1 to 9 as we can set in wich order the plugin should be ouput , default 5

force => false // froce the output to be in the order set if another plugin is set with the same order , default false

EXTRA OPTION

php => 'Myplugin.Myfunction" // if set the fallowing php function will be exucuted .

that all at the moment for structure event , and i make another push or the other event .

 

Client Edit Profile
Client Change Password
Client Delete (Before & After action )
Client Profile Tab Fields (dropdown menu)
Contact Add | Contact Edit | Contact Delete
Client Dashboard Page Load
Client Pay Method
Client Pay Confirm
Admin Dashboard Page Load
Daily CronJob (Before & After action )
Invoice Payment Reminder
Accept Order
Delete Order
Pending Order
Order Checkout
Shopping Cart Checkout Page
Show Cart Page
Module Create (Before & After action )
Module Suspend (Before & After action )
Module unSuspend (Before & After action )
Module terminate (Before & After action )
Admin/Client Services Tab Fields (rendered)
upload Files action

Ticket Plugin :
Add - reply - close tickets

Download Manager Plugin
Download (Before & After action )
Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...