Skip to content

feat: template function injection #2

Description

@whizark
  1. add action hook(s) into the closure that creates a new environment
  2. include plain-old-PHP-file at the hook
// A plain-old-PHP-functioin
if (!function_exists('static_function')) {
    function static_function() {
        // do something.
    }
}

// A dynamic function should be injected as a (partial) template variable.
$_dynamic_function = function () {
    // do something.
};

// A template function wrapper.
if (!function_exists('dynamic_function')) {
    function dynamic_function() use ($_dynamic_function) {
        return $_dynamic_function();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions