What is the correct way to add a new action to the current list of actions?
Is there a specific EE method to add a new action? Or is it just direct database manipulation(that is, add it via SQL)?
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It only takes a minute to sign up.
Sign up to join this communityWhat is the correct way to add a new action to the current list of actions?
Is there a specific EE method to add a new action? Or is it just direct database manipulation(that is, add it via SQL)?
Usually it's done on the install method of your addon. Best practice is to take advantage of ActiveRecord and a db->insert:
$data = array(
'class' => $this->class,
'method' => $method
);
ee()->db->insert('actions', $data);
You don't need to specify an ACTion ID as this is auto incremented.
You can find a bit more information in the docs for Module Installation.