diff --git a/flextype/core/Snippets.php b/flextype/core/Snippets.php index 3bf94cfb..ad53c7fe 100644 --- a/flextype/core/Snippets.php +++ b/flextype/core/Snippets.php @@ -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); diff --git a/flextype/shortcodes/SnippetsShortcode.php b/flextype/shortcodes/SnippetsShortcode.php index 2d78a4dc..f4754fa0 100644 --- a/flextype/shortcodes/SnippetsShortcode.php +++ b/flextype/shortcodes/SnippetsShortcode.php @@ -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')); });