Skip to content

Commit 6f08161

Browse files
authored
Merge pull request #1 from tattersoftware/develop
Merge for release
2 parents 85754f7 + 8ee5317 commit 6f08161

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

Alerts.php.example renamed to bin/Alerts.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
/***
44
*
5-
* This file contains example values to override or augment default library behavior.
5+
* This file contains example values to change the default library behavior.
66
* Recommended usage:
77
* 1. Copy the file to app/Config/Alerts.php
88
* 2. Set any override variables
9-
* 3. Remove any lines to fallback to defaults
9+
* 3. Remove any lines to fallback to library defaults
1010
*
1111
***/
1212

13-
use CodeIgniter\Config\BaseConfig;
14-
1513
class Alerts extends \Tatter\Alerts\Config\Alerts
1614
{
1715
// prefix for SESSION variables and HTML classes, to prevent collision

src/Alerts.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php namespace Tatter\Alerts;
22

33
/***
4-
* Name: Alerts
5-
* Author: Matthew Gatner
4+
* Name: Alerts
5+
* Author: Matthew Gatner
66
* Contact: mgatner@tattersoftware.com
77
* Created: 2019-02-13
88
*
@@ -17,8 +17,8 @@
1717
* Use Config/Alerts.php to override default behavior
1818
*
1919
* @package CodeIgniter4-Alerts
20-
* @author Matthew Gatner
21-
* @link https://github.com/tattersoftware/codeigniter4-alerts
20+
* @author Matthew Gatner
21+
* @link https://github.com/tattersoftware/codeigniter4-alerts
2222
*
2323
***/
2424

@@ -116,6 +116,6 @@ public function display()
116116
// should be injected into <head>
117117
public function css()
118118
{
119-
return $this->view->setVar('prefix', $this->config->prefix)->render("Tatter\Alerts\Views\css");
119+
return $this->view->setVar('prefix', $this->config->prefix)->render('Tatter\Alerts\Views\css');
120120
}
121121
}

src/Config/Services.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@ public static function alerts(BaseConfig $config = null, RendererInterface $view
1111
return static::getSharedInstance('alerts', $config, $view);
1212
endif;
1313

14-
// prioritizes user config in app/Config if found
15-
if (empty($config)):
16-
if (class_exists('\Config\Alerts')):
17-
$config = new \Config\Alerts();
18-
else:
19-
$config = new \Tatter\Alerts\Config\Alerts();
20-
endif;
21-
endif;
14+
// If no config was injected then load one
15+
// Prioritizes app/Config if found
16+
if (empty($config))
17+
$config = config('Alerts');
2218

2319
return new \Tatter\Alerts\Alerts($config, $view);
2420
}

src/Exceptions/AlertsException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ class AlertsException extends FrameworkException implements ExceptionInterface
77
{
88
public static function forInvalidTemplate(string $template = null)
99
{
10-
return new static("'{$template}' is not a valid Alerts template.");
10+
return new static(lang('Alerts.invalidTemplate', [$template]));
1111
}
1212
public static function forMissingTemplateView(string $template = null)
1313
{
14-
return new static("Could not find template view file: '{$template}'.");
14+
return new static(lang('Alerts.missingTemplateView', [$template]));
1515
}
1616
}

src/Language/en/Alerts.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
return [
4+
'invalidTemplate' => '"{0}" is not a valid Alerts template.',
5+
'missingTemplateView' => 'Could not find template view file: "{0}".',
6+
];

0 commit comments

Comments
 (0)