From 3406b380207b335f22942871f79fd01e83221f38 Mon Sep 17 00:00:00 2001 From: Patrick Ward Date: Fri, 23 Oct 2015 16:00:25 -0400 Subject: [PATCH] Updating readme --- README.md | 28 ++++++++++++++++++++++++++++ classes/ServiceProvider.php | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4373188..6af0cff 100644 --- a/README.md +++ b/README.md @@ -60,3 +60,31 @@ You can strip shortcodes from text using the `Shortcode::strip` function. For ex Event::listen('sensory5.blog.summary', function($content) { return Str::limit(Html::strip(\Shortcode::strip($content)), 600); }); + +### Dependency Issues with Service Provider and Facade + +When using this plugin within another plugin, you may find that the Service Provider and/or Facade are not loaded if the dependant plugin loads prior to the Shortcode plugin. + +In that case, you can either explicitly register the Shortcode plugin within the `boot` method of the plugin. For example: + + // Add Shortcode Service provider + App::register('\Sensory5\Shortcode\Classes\ServiceProvider'); + + // Add Shortcode facade + $alias = AliasLoader::getInstance(); + $alias->alias('Shortcode', '\Sensory5\Shortcode\Classes\Facade'); + +Or, you can add the Service Provider and Facade into the `config/app.php` file at the root of the OctoberCMS site. For example: + + 'providers' => array_merge(include(base_path().'/modules/system/providers.php'), [ + + 'System\ServiceProvider', + 'Sensory5\Shortcode\Classes\ServiceProvider' + + ]), + + 'aliases' => array_merge(include(base_path().'/modules/system/aliases.php'), [ + + 'Shortcode' => 'Sensory5\Shortcode\Classes\Facade' + + ]), diff --git a/classes/ServiceProvider.php b/classes/ServiceProvider.php index 30ca686..b88b330 100644 --- a/classes/ServiceProvider.php +++ b/classes/ServiceProvider.php @@ -11,7 +11,7 @@ class ServiceProvider extends ServiceProviderParent public function register() { $this->app->bind('shortcode', function() { - return new Shortcode(); + return new Shortcode; }); }