1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-12 16:14:16 +02:00

Flextype Core: Snippets API fixes #117

This commit is contained in:
Awilum
2019-06-11 16:32:26 +03:00
parent aa3bff58bf
commit da79f85895
2 changed files with 4 additions and 9 deletions

View File

@@ -41,11 +41,7 @@ class Snippets
*/
public function display(string $id)
{
$vars = [];
$vars['fetch'] = $id;
return $this->_display_snippet($vars);
return $this->_display_snippet(['fetch' => $id]);
}
/**
@@ -195,12 +191,11 @@ class Snippets
*/
private function _display_snippet(array $vars)
{
// Extracst attributes
extract($vars);
// Get snippet name
$name = (isset($id)) ? (string) $id : '';
$name = (isset($fetch)) ? (string) $fetch : '';
// Define snippet path
$snippet_file = $this->_file_location($name);

View File

@@ -15,7 +15,7 @@ namespace Flextype;
use Thunder\Shortcode\ShortcodeFacade;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
// Shortcode: [snippets id=snippet-name]
// Shortcode: [snippets fetch=snippet-name]
$flextype['shortcodes']->addHandler('snippets', function (ShortcodeInterface $s) use ($flextype) {
return $flextype['shortcodes']->display($s->getParameter('id'));
return $flextype['snippets']->display($s->getParameter('fetch'));
});