tattersoftware / codeigniter4-outbox

Email toolkit for CodeIgniter 4
MIT License
16 stars 5 forks source link

Can't disable default styles #11

Closed chrisastley closed 3 years ago

chrisastley commented 3 years ago

Hi,

I'm trying to disable the default styles.

I have tried removing the file path from app/Config/Outbox.php public $styles = ''; I have tried adding null to the value in app/Config/Outbox.php public $styles = null;

I can see that the renderBody function allows the $styles parameter to have a default of null but must be type string so I'm not sure if I'm misinterpreting the code or this is a bug.

Do you know how I could pass a custom style on a per email basis or set it to null so the default is not included?

Thanks in advance.

MGatner commented 3 years ago

Setting it to the empty string should work ''. Using null on Template tells it to load from the Config:

return $styles === '' ? $body : (new CssToInlineStyles)->convert($body, $styles);

So either passing the empty string or setting it in the Config (or both) should work. Did that not work for you?

chrisastley commented 3 years ago

If I set the value in Config/Outbox.php to '' I get this error.

> 
#0 /var/www/vhosts/*****/htdocs/vendor/codeigniter4/framework/system/View/View.php(203): CodeIgniter\Exceptions\FrameworkException::forInvalidFile('.php')
#1 /var/www/vhosts/*****/htdocs/vendor/codeigniter4/framework/system/Common.php(1217): CodeIgniter\View\View->render('', Array, true)
#2 /var/www/vhosts/*****/htdocs/vendor/tatter/outbox/src/Entities/Template.php(114): view('', Array, Array)
#3 /var/www/vhosts/*****/htdocs/vendor/tatter/outbox/src/Entities/Template.php(110): Tatter\Outbox\Entities\Template->renderBody(Array, NULL)
#4 /var/www/vhosts/*****/htdocs/vendor/tatter/outbox/src/Entities/Template.php(161): Tatter\Outbox\Entities\Template->renderBody(Array, NULL)
#5 /var/www/vhosts/*****/htdocs/app/Helpers/mail_helper.php(26): Tatter\Outbox\Entities\Template->email(Array)
#6 /var/www/vhosts/*****/htdocs/app/Controllers/Suppliers/DropshipController.php(57): mail_send(Array, Object(stdClass), NULL)
#7 /var/www/vhosts/*****/htdocs/vendor/codeigniter4/framework/system/CodeIgniter.php(936): App\Controllers\Suppliers\DropshipController->process_dropshipments()
#8 /var/www/vhosts/*****/htdocs/vendor/codeigniter4/framework/system/CodeIgniter.php(432): CodeIgniter\CodeIgniter->runController(Object(App\Controllers\Suppliers\DropshipController))
#9 /var/www/vhosts/*****/htdocs/vendor/codeigniter4/framework/system/CodeIgniter.php(333): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
#10 /var/www/vhosts/*****/htdocs/public/index.php(44): CodeIgniter\CodeIgniter->run()
#11 {main}
MGatner commented 3 years ago

Okay I will take a look.