Adding fields to the default controller to be processed

Souther

New Member
I want to add a couple settings to the Campaign configuration.

I've used:
Code:
if ($this->isAppName('customer')) {
        Yii::app()->hooks->addAction('after_active_form_fields', function($collection) {
...to add the fields to the form. But i'm not quite sure how to tap into the default controller to save the new fields I added to the form. I think I need to use:
{
Code:
Yii::app()->hooks->addAction('controller_action_save_data', function($collection) {
...but I'm having difficulty connecting the dots because I am not a great PHP programmer, yet.

Any help would be appreciated.
 
Something like:
Code:
Yii::app()->hooks->addAction('controller_action_save_data', function($collection) {
    if ($collection->controller->id != 'campaigns' || $collection->controller->action->id != 'the action name here, i.e: overview') {
         return;
    }
    // continue here accessing $collection-> properties which are available depending on the action you connect to.
});
 
@twisted1919 Thanks!

When I look for the new fields I added via the addAction (after_active_form_fields) I do not see them in $collection->campaign->attributes. Do I need to add yet another hook to add these fields to be processed by the controller upon post?
 
When I look for the new fields I added via the addAction (after_active_form_fields) I do not see them in $collection->campaign->attributes
They are in the POST array, so fetch them with Yii::app()->request->getPost('input-field-name');
 
Back
Top