Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Templating
    • Utils
  • NetteModule
  • none
  • Tracy
    • Bridges
      • Nette

Classes

  • BlockMacros
  • BlockMacrosRuntime
  • CoreMacros
  • MacroSet
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Latte (http://latte.nette.org)
 5:  * Copyright (c) 2008 David Grudl (http://davidgrudl.com)
 6:  */
 7: 
 8: namespace Latte\Macros;
 9: 
10: use Latte;
11: use Latte\RuntimeException;
12: 
13: 
14: /**
15:  * Runtime helpers for block macros.
16:  */
17: class BlockMacrosRuntime extends Latte\Object
18: {
19: 
20:     /**
21:      * Calls block.
22:      * @return void
23:      */
24:     public static function callBlock(\stdClass $context, $name, array $params)
25:     {
26:         if (empty($context->blocks[$name])) {
27:             throw new RuntimeException("Cannot include undefined block '$name'.");
28:         }
29:         $block = reset($context->blocks[$name]);
30:         $block($context, $params);
31:     }
32: 
33: 
34:     /**
35:      * Calls parent block.
36:      * @return void
37:      */
38:     public static function callBlockParent(\stdClass $context, $name, array $params)
39:     {
40:         if (empty($context->blocks[$name]) || ($block = next($context->blocks[$name])) === FALSE) {
41:             throw new RuntimeException("Cannot include undefined parent block '$name'.");
42:         }
43:         $block($context, $params);
44:         prev($context->blocks[$name]);
45:     }
46: 
47: }
48: 
Nette 2.3.4 API API documentation generated by ApiGen 2.8.0