public function shortcodeBlock(Event $event, array $atts, $content, $tag)
    {
        $out = '';
        if (isset($atts[0])) {
            $id = intval($atts[0]);
            try {
                $block = TableRegistry::get('Block.Blocks')->get($id);
                $out = $event->subject()->render($block);
            } catch (\Exception $ex) {
                $out = !Configure::read('debug') ? '' : "<!-- block #{$id} not found -->";
            }
        }

        return $out;
    }
public function shortcodeBlock(Event $event, array $atts, $content, $tag)
    {
        $out = '';
        if (isset($atts[0])) {
            $id = intval($atts[0]);
            try {
                $block = TableRegistry::get('Block.Blocks')->get($id);
                $out = $event->subject()->render($block);
            } catch (\Exception $ex) {
                $out = !Configure::read('debug') ? '' : "<!-- block #{$id} not found -->";
            }
        }

        return $out;
    }
public function shortcodeBlock ( Event $ event , array $ atts , $ content , $ tag ) { $ out = '' ; if ( isset ( $ atts [ 0 ] ) ) { $ id = intval ( $ atts [ 0 ] ) ; try { $ block = TableRegistry :: get ( 'Block.Blocks' ) -> get ( $ id ) ; $ out = $ event -> subject ( ) -> render ( $ block ) ; } catch ( \ Exception $ ex ) { $ out = ! Configure :: read ( 'debug' ) ? '' : "<!-- block #{$id} not found -->" ; } } return $ out ; }
Implements the "block" shortcode.

{block 1 /}

@param \Cake\Event\Event $event The event that was fired
@param array $atts An associative array of attributes, or an empty string if
no attributes are given
@param string $content The enclosed content (if the shortcode is used in its
enclosing form)
@param string $tag The shortcode name
@return string
Implements the block shortcode .