Skip to content

Commit

Permalink
Merge branch 'release/1.0.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Jan 19, 2018
2 parents e728f39 + 8acb5cf commit b30369e
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 29 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"autoload": {
"psr-4": {
"modules\\site\\": "modules/site/src/"
"modules\\sitemodule\\": "modules/sitemodule/src/"
}
},
"config": {
Expand Down
8 changes: 5 additions & 3 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@

// All environments
'*' => [
'modules' => [
'site' => \modules\site\SiteModule::class,
'modules' => [
'site-module' => [
'class' => \modules\sitemodule\SiteModule::class,
],
],
'bootstrap' => ['site'],
'bootstrap' => ['site-module'],
],

// Live (production) environment
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions modules/site/README.md → modules/sitemodule/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ First, you'll need to add the contents of the `app.php` file to your `config/app
```
return [
'modules' => [
'site' => \modules\site\SiteModule::class,
'site-module' => [
'class' => \modules\sitemodule\SiteModule::class,
],
],
'bootstrap' => ['site'],
'bootstrap' => ['site-module'],
];
```
You'll also need to make sure that you add the following to your project's `composer.json` file so that Composer can find your module:

"autoload": {
"psr-4": {
"modules\\site\\": "modules/site/src/"
"modules\\sitemodule\\": "modules/sitemodule/src/"
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
*/
return [
'modules' => [
'site' => \modules\site\SiteModule::class,
'site-module' => [
'class' => \modules\sitemodule\SiteModule::class,
],
],
'bootstrap' => ['site'],
'bootstrap' => ['site-module'],
];
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* @copyright Copyright (c) 2018 nystudio107
*/

namespace modules\site;
namespace modules\sitemodule;

use modules\site\assetbundles\site\SiteAsset;
use modules\sitemodule\assetbundles\sitemodule\SiteModuleAsset;

use Craft;
use craft\events\RegisterTemplateRootsEvent;
Expand All @@ -23,10 +23,10 @@
use yii\base\Module;

/**
* Class Site
* Class SiteModule
*
* @author nystudio107
* @package Site
* @package SiteModule
* @since 1.0.0
*
*/
Expand All @@ -36,7 +36,7 @@ class SiteModule extends Module
// =========================================================================

/**
* @var Site
* @var SiteModule
*/
public static $instance;

Expand All @@ -48,8 +48,8 @@ class SiteModule extends Module
*/
public function __construct($id, $parent = null, array $config = [])
{
Craft::setAlias('@site', $this->getBasePath());
$this->controllerNamespace = 'site\controllers';
Craft::setAlias('@sitemodule', $this->getBasePath());
$this->controllerNamespace = 'sitemodule\controllers';

// Translation category
$i18n = Craft::$app->getI18n();
Expand All @@ -58,7 +58,7 @@ public function __construct($id, $parent = null, array $config = [])
$i18n->translations[$id] = [
'class' => PhpMessageSource::class,
'sourceLanguage' => 'en-US',
'basePath' => '@site/translations',
'basePath' => '@sitemodule/translations',
'forceTranslation' => true,
'allowOverrides' => true,
];
Expand Down Expand Up @@ -91,7 +91,7 @@ public function init()
View::EVENT_BEFORE_RENDER_TEMPLATE,
function (TemplateEvent $event) {
try {
Craft::$app->getView()->registerAssetBundle(SiteAsset::class);
Craft::$app->getView()->registerAssetBundle(SiteModuleAsset::class);
} catch (InvalidConfigException $e) {
Craft::error(
'Error registering AssetBundle - '.$e->getMessage(),
Expand All @@ -104,7 +104,7 @@ function (TemplateEvent $event) {

Craft::info(
Craft::t(
'site',
'site-module',
'{name} module loaded',
['name' => 'Site']
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?php
/**
* Site plugin for Craft CMS 3.x
* Site module for Craft CMS 3.x
*
* An example module for Craft CMS 3 that lets you enhance your websites with a custom site module
*
* @link https://nystudio107.com/
* @copyright Copyright (c) 2018 nystudio107
*/

namespace modules\site\assetbundles\Site;
namespace modules\sitemodule\assetbundles\SiteModule;

use Craft;
use craft\web\AssetBundle;
use craft\web\assets\cp\CpAsset;

/**
* @author nystudio107
* @package Site
* @package SiteModule
* @since 1.0.0
*/
class SiteAsset extends AssetBundle
class SiteModuleAsset extends AssetBundle
{
// Public Methods
// =========================================================================
Expand All @@ -29,18 +29,18 @@ class SiteAsset extends AssetBundle
*/
public function init()
{
$this->sourcePath = "@site/assetbundles/site/dist";
$this->sourcePath = "@sitemodule/assetbundles/sitemodule/dist";

$this->depends = [
CpAsset::class,
];

$this->js = [
'js/Site.js',
'js/SiteModule.js',
];

$this->css = [
'css/Site.css',
'css/SiteModule.css',
];

parent::init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
* @author nystudio107
* @copyright Copyright (c) 2018 nystudio107
* @link https://nystudio107.com/
* @package Site
* @package SiteModule
* @since 1.0.0
*/
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
* @author nystudio107
* @copyright Copyright (c) 2018 nystudio107
* @link https://nystudio107.com/
* @package Site
* @package SiteModule
* @since 1.0.0
*/
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/**
* @author nystudio107
* @package Site
* @package SiteModule
* @since 1.0.0
*/
return [
Expand Down

0 comments on commit b30369e

Please sign in to comment.