getHelper

Creates the helper and set the router

@param string $helper
@param array  $params

@return mixed The view helper
779141
public function getHelper($helper, $params=array())
    {
        parent::getHelper($helper, $params);

        $viewHelper = new $this->_helperClassName();

        $viewHelper->setParams($params);
        $viewHelper->setRouter($this->_router);

        return $viewHelper;
    }
762089
protected function _getRegisterHelper() {
        $registerHelper = $this->_helper->getHelper('Register');
        if (!$registerHelper) {
            return null;
        }
        if (!$registerHelper instanceof Garp_Controller_Helper_Register) {
            throw new Garp_Auth_Exception(self::EXCEPTION_INVALID_REGISTER_HELPER);
        }
        return $registerHelper;
    }
202797
static public function addAppHelpers(array $helpers)
    {
        self::$appQueue = array_merge(self::$appQueue, array_map(function($c) { return $c . 'Helper'; }, $helpers));
    }
824750
public static function getViewHelper($appName = null, bool $layout = false)
    {
        if ($appName === false) {
            $class = '\Osf\View\Helper';
            $instance = 'osf';
        } else {
            $appName = $appName === null ? Router::getDefaultControllerName(true) : $appName;
            $class = "\\App\\" . $appName . '\View\Helper';
            $instance = $appName;
        }
        $viewName = $layout ? 'layout' : 'view';
        $instance .= $layout ? '_l' : '_v';
        return self::buildObject($class, [$viewName]); //, $instance);
    }
181443
public function addHelpers(array $helpers)
    {
        foreach ($helpers as $alias => $helper) {
            $this->set($helper, \is_int($alias) ? null : $alias);
        }
    }
1022239
public function getHelpConfiguration(array $parameters = array(), $multipart = false, $appOnlyAuth = false)
    {
        return $this->get("help/configuration", $parameters, $multipart, $appOnlyAuth);
    }
745336
public function createHelper($method, $argv)
    {
        $helper = null;
        $helperClass = 'BackBee\Renderer\Helper\\'.$method;
        if (true === class_exists($helperClass)) {
            $this->helpers->set($method, new $helperClass($this, $argv));
            $helper = $this->helpers->get($method);
        }

        return $helper;
    }
274625
private function validate_helper_input( $helper ) {
		if ( ! is_array( $helper ) || empty( $helper ) ) {
			return false;
		}

		if ( !  isset( $helper[ 'name' ] ) || ! isset( $helper[ 'class' ]  ) ) {
			return false;
		}

		//if not set, set callback name to "helper"
		if ( ! isset( $helper[ 'callback' ] ) ) {
			$helper[ 'callback' ] = 'helper';
		}

		return $helper;

	}
1001124
public function getHelpersBroker() {
		if ($this->_helperBroker === null) {
			if ($this instanceof LocatorAwareInterface && $this->hasLocator()) {
				$this->_helperBroker = $this->getLocator()->get($this->getHelpersBrokerServiceId());
				
				if (! $this->_helperBroker instanceof HelpersLocatorInterface) {
					throw new NoHelpersBroker('Helper\'s broker must implement the "HelpersLocatorInterface"');
				}
			} else {
				throw new NoHelpersBroker('No helper\'s broker been supplied, also unable to obtain one through locator');
			}
		}
		
		return $this->_helperBroker;
	}
1105623
public function getHelper($helperName) {
		//first check if we've already instantiated this Helper
		$helper = $this->getCachedHelper($helperName);
		if (!$helper) {
			foreach (array($this->getSiteConfig()['NAMESPACE_APP'],$this->getSiteConfig()['NAMESPACE_CORE']) as $classPath) {
				$className = "{$classPath}Classes\\Helpers\\{$helperName}";
				//We found a Helper named $helperName, so let's instantiate, configure and cache it
				if (class_exists($className)) {
					$helper = new $className();
					$helper->configure($this);
					$this->addCachedHelper($helperName,$helper);
					$this->getLogger()->debug("Providing FRESH Helper: ".$helperName);
					break;
				}
			}
			if (!$helper) {
				$this->getLogger()->error("Could not find Helper: ".$helperName);
			}
		} else {
			$this->getLogger()->debug("Providing CACHED Helper: ".$helperName);
		}
		return $helper;
	}
7210
public function setHelperPluginManager($helpers)
    {
        if (is_string($helpers)) {
            if (!class_exists($helpers)) {
                throw new Exception\InvalidArgumentException(sprintf(
                    'Invalid helper helpers class provided (%s)',
                    $helpers
                ));
            }
            $helpers = new $helpers();
        }
        if (!$helpers instanceof HelperPluginManager) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Helper helpers must extend HumusMvc\View\HelperPluginManager; got type "%s" instead',
                (is_object($helpers) ? get_class($helpers) : gettype($helpers))
            ));
        }
        $helpers->setView($this);
        $this->_helpers = $helpers;

        return $this;
    }
423770
public function createHelper($helper, array $config = array())
    {
        if(is_string($helper) && strpos($helper, '.') === false )
        {
            $identifier = $this->getIdentifier()->toArray();
            $identifier['name'] = $helper;
        }
        else $identifier = $helper;

        //Create the template helper
        $helper = $this->getObject($identifier, $config);

        //Check the helper interface
        if (!($helper instanceof TemplateHelperInterface))
        {
            throw new \UnexpectedValueException(
                "Template helper $identifier does not implement TemplateHelperInterface"
            );
        }

        return $helper;
    }
778591
protected function instanceHelper()
    {
        if (method_exists($this->builder, 'helper'))
        {
            return $this->builder->helper();
        }

        return new DeimosHelper($this->builder);
    }
367723
private function _getHelper($helper)
  {
    $instance = null;
    foreach ($this->_prefixes as $prefix) {
      $className = $prefix . "\\" . $helper;
      if (Loader::loadClass($className)) {
        if (is_subclass_of($className, __NAMESPACE__ . "\\Helper_Interface")) {
          $instance = new $className();
          /* @var $instance Helper_Interface */
          $instance->setSubject($this->_subject);
        }
        break;
      }
    }
    return $instance;
  }
1043272
public function helper($helper)
    {
        $helperPath = $this->getHelperPath($helper);

        if ($helperPath === null) {
            throw new InvalidArgumentException("Helper [{$helper}] not found.");
        }

        $args = func_get_args();
        unset($args[0]);

        $callback = include($helperPath);

        if (!is_callable($callback)) {
            throw new BadFunctionCallException("Helper [{$helper}] is invalid.");
        }

        return call_user_func_array($callback, $args);
    }
511517
protected function helper($helperName)
    {
        if (!isset($this->helpers[$helperName])) {
            throw new \InvalidArgumentException('Unable to locate controller helper: ' . $helperName);
        }

        return $this->helpers[$helperName];
    }
677551
function getHelper(helper) {
		// Helper method called as view.hlp(key) from compiled template, for helper functions or template parameters ~foo
		var wrapped,
			view = this,
			res = (view.ctx || {})[helper];

		res = res === undefined ? view.getRsc("helpers", helper) : res;

		if (res) {
			if (typeof res === "function") {
				wrapped = function() {
					// If it is of type function, we will wrap it so it gets called with view as 'this' context.
					// If the helper ~foo() was in a data-link expression, the view will have a 'temporary' linkCtx property too.
					// However note that helper functions on deeper paths will not have access to view and tagCtx.
					// For example, ~util.foo() will have the ~util object as 'this' pointer
					return res.apply(view, arguments);
				};
				$extend(wrapped, res);
			}
		}
		return wrapped || res;
	}