FEATURE: add shortcodes into binarity template

This commit is contained in:
Michal Kváček
2017-03-23 00:19:05 +01:00
parent 42066d4ae9
commit 69253693ce
5 changed files with 27 additions and 40 deletions
+1 -37
View File
@@ -6,10 +6,7 @@ use App\Models\Content\Content;
use App\Models\Module;
use App\Models\User;
use App\Models\Widgets\WidgetArea;
use Templates\Binarity\Shortcodes\DarkBlock;
use Templates\Binarity\Shortcodes\TechnologiesWrapper;
use Templates\Binarity\Shortcodes\Technology;
use Webwizo\Shortcodes\Facades\Shortcode;
class Handler implements TemplateHandler
{
@@ -85,37 +82,4 @@ class Handler implements TemplateHandler
],
];
}
/**
* Prepare Content object to be rendered using Blade template
*
* @param Content $content
*/
public static function beforeRender(Content & $content)
{
Shortcode::register('technologies', TechnologiesWrapper::class);
Shortcode::register('tech', Technology::class);
Shortcode::register('dark', DarkBlock::class);
}
/**
* Modify input data into format which can be understood by edit template
*
* @param Content $content
*/
public static function beforePopulatingEditForm(Content & $content)
{
}
/**
* Slightly modify Content object before saving into database.
*
* This way we can do almost whatever we want - even in template
*
* @param Content $content
* @param $request
*/
public static function beforeSave(Content & $content, $inputData)
{
}
}
@@ -0,0 +1,22 @@
<?php
namespace Templates\Binarity\Providers;
use Templates\Binarity\Shortcodes\DarkBlock;
use Templates\Binarity\Shortcodes\TechnologiesWrapper;
use Templates\Binarity\Shortcodes\Technology;
use Webwizo\Shortcodes\Facades\Shortcode;
class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
Shortcode::register('technologies', TechnologiesWrapper::class);
Shortcode::register('tech', Technology::class);
Shortcode::register('dark', DarkBlock::class);
}
}
@@ -140,7 +140,7 @@
.cz</a></li>
<li class="phone-li"><a href="tel:00420775323455">+420 775 323 455</a></li>
<li><br></li>
<li>&copy; 2016 binarity s.r.o.</li>
<li>&copy; {date('Y') binarity s.r.o.</li>
</ul>
<div class="clearfix"></div>
</footer>
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
return [
'providers' => [],
'providers' => [\Templates\Binarity\Providers\BinarityServiceProvider::class],
'files' => [],
'handler' => \Templates\Binarity\Handler::class,
'name' => 'binarity s.r.o.',