unregisterPlugin example


        $this->registerPlugin('function', $function$function_impl$cacheable$cache_attrs);
    }

    /** * Unregisters custom function * * @param string $function name of template function */
    public function unregister_function($function)
    {
        $this->unregisterPlugin('function', $function);
    }

    /** * Registers object to be used in templates * * @param string $object name of template object * @param object $object_impl the referenced PHP object to register * @param array $allowed list of allowed methods (empty = all) * @param boolean $smarty_args smarty argument format, else traditional * @param array $block_functs list of methods that are block format */
    
$container = $this->Application()->Container();
        if ($this->acl === null) {
            $this->acl = $container->get('acl');
        }
        if ($auth->hasIdentity()) {
            $identity = $auth->getIdentity();
            $this->aclRole = $identity->role;
        }

        /** @var Enlight_Template_Manager $engine */
        $engine = $container->get(Enlight_Template_Manager::class);
        $engine->unregisterPlugin(
            Smarty::PLUGIN_FUNCTION,
            'acl_is_allowed'
        );
        $engine->registerPlugin(
            Smarty::PLUGIN_FUNCTION,
            'acl_is_allowed',
            [$this, 'isAllowed']
        );
    }

    /** * @return string */
Home | Imprint | This part of the site doesn't use cookies.