Add a new delivery server with extension

Matt95c

Member
Hi,

I have read https://kb.mailwizz.com/articles/add-a-new-delivery-server-type/ and i want to make my mod with a personal extension.
How can I "link" my form view (section 3 on article) in my extension folder ?

Thanks.

My code
PHP:
public function run()
{

// import delivery server model
Yii::import('ext-mydelivery.common.models.*');

// add delivery server type
Yii::app()->hooks->addFilter('delivery_servers_get_types_mapping', function($mapping){
            $mapping['mydelivery'] = 'DeliveryServerMyDelivery';
            return $mapping;
        });

// How to add my form view from my extension ? 
// /Ext Folder/{backend,customer}/views/delivery_servers/form-mydelivery.php

}
 
Is there a hook what i can use in DeliveryController to change folder only for my delivery server ?
If I need another extension for another type of delivery server, i will overwrite my controller who overwrite Delivery_serversController and that's not in the spirit of extends.
 
Nice !

I think i can use this hook defined in BaseController to change folder :
$hooks->doAction($appName . '_controller_'.$this->id.'_before_render', $view);

So
PHP:
//Add my form
Yii::app()->hooks->addAction('backend_controller_delivery_servers_before_render',function ($view){
  if($view=='form-mydelivery'){
    $controller=Yii::app()->getController();
    $file=Yii::getPathOfAlias('ext-mydelivery.backend.views.delivery_servers'); // path : /ext-path/backend/views/delivery_servers/
    $controller->renderFile($file);
  }
}
 
Back
Top