Browse Source

Updating readme

master
Patrick Ward 9 years ago
parent
commit
3406b38020
  1. 28
      README.md
  2. 2
      classes/ServiceProvider.php

28
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) { Event::listen('sensory5.blog.summary', function($content) {
return Str::limit(Html::strip(\Shortcode::strip($content)), 600); 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'
]),

2
classes/ServiceProvider.php

@ -11,7 +11,7 @@ class ServiceProvider extends ServiceProviderParent
public function register() public function register()
{ {
$this->app->bind('shortcode', function() { $this->app->bind('shortcode', function() {
return new Shortcode();
return new Shortcode;
}); });
} }

Loading…
Cancel
Save