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:
@@ -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);
|
||||
|
@@ -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'));
|
||||
});
|
||||
|
Reference in New Issue
Block a user