Skip to content

Commit

Permalink
Merge pull request #1 from tattersoftware/develop
Browse files Browse the repository at this point in the history
Merge for release
  • Loading branch information
MGatner authored Jul 2, 2019
2 parents 85754f7 + 8ee5317 commit 6f08161
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
6 changes: 2 additions & 4 deletions Alerts.php.example → bin/Alerts.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

/***
*
* This file contains example values to override or augment default library behavior.
* This file contains example values to change the default library behavior.
* Recommended usage:
* 1. Copy the file to app/Config/Alerts.php
* 2. Set any override variables
* 3. Remove any lines to fallback to defaults
* 3. Remove any lines to fallback to library defaults
*
***/

use CodeIgniter\Config\BaseConfig;

class Alerts extends \Tatter\Alerts\Config\Alerts
{
// prefix for SESSION variables and HTML classes, to prevent collision
Expand Down
10 changes: 5 additions & 5 deletions src/Alerts.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php namespace Tatter\Alerts;

/***
* Name: Alerts
* Author: Matthew Gatner
* Name: Alerts
* Author: Matthew Gatner
* Contact: [email protected]
* Created: 2019-02-13
*
Expand All @@ -17,8 +17,8 @@
* Use Config/Alerts.php to override default behavior
*
* @package CodeIgniter4-Alerts
* @author Matthew Gatner
* @link https://github.com/tattersoftware/codeigniter4-alerts
* @author Matthew Gatner
* @link https://github.com/tattersoftware/codeigniter4-alerts
*
***/

Expand Down Expand Up @@ -116,6 +116,6 @@ public function display()
// should be injected into <head>
public function css()
{
return $this->view->setVar('prefix', $this->config->prefix)->render("Tatter\Alerts\Views\css");
return $this->view->setVar('prefix', $this->config->prefix)->render('Tatter\Alerts\Views\css');
}
}
12 changes: 4 additions & 8 deletions src/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@ public static function alerts(BaseConfig $config = null, RendererInterface $view
return static::getSharedInstance('alerts', $config, $view);
endif;

// prioritizes user config in app/Config if found
if (empty($config)):
if (class_exists('\Config\Alerts')):
$config = new \Config\Alerts();
else:
$config = new \Tatter\Alerts\Config\Alerts();
endif;
endif;
// If no config was injected then load one
// Prioritizes app/Config if found
if (empty($config))
$config = config('Alerts');

return new \Tatter\Alerts\Alerts($config, $view);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Exceptions/AlertsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ class AlertsException extends FrameworkException implements ExceptionInterface
{
public static function forInvalidTemplate(string $template = null)
{
return new static("'{$template}' is not a valid Alerts template.");
return new static(lang('Alerts.invalidTemplate', [$template]));
}
public static function forMissingTemplateView(string $template = null)
{
return new static("Could not find template view file: '{$template}'.");
return new static(lang('Alerts.missingTemplateView', [$template]));
}
}
6 changes: 6 additions & 0 deletions src/Language/en/Alerts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

return [
'invalidTemplate' => '"{0}" is not a valid Alerts template.',
'missingTemplateView' => 'Could not find template view file: "{0}".',
];

0 comments on commit 6f08161

Please sign in to comment.