public function render(Renderable $element)
	{
		// First get the name of the class
		$className = $this->getClassName($element);

		// Work out the function name to look for
		$functionName = static::$methodPrefix . $className;

		// Something to store the callable name in for later
		$callName = '';

		// TODO: find a cleaner way of doing this
		$is_container = $element instanceof Form;

		if ($is_container)
		{
			$this->csrfProvider->insertTokenPreRender($element);
		}

		// Check to see if our method is callable
		if (is_callable([$this, $functionName], false, $callName))
		{
			$result = $this->{$functionName}($element);
		}
		// If not callable then use the default function
		else
		{
			// Check for a generic fallback in the renderer

			$inputRenderFunction = static::$methodPrefix . 'Input';
			$inputRender = [$this, $inputRenderFunction];

			if (is_callable($inputRender))
			{
				$result = $this->$inputRenderFunction($element);
			}
			else
			{
				// Finally check if there is a render method in the object
				$elementRender = [$element, 'render'];

				if (is_callable($elementRender))
				{
					// If so call the render method
					$result = $element->render($this);
				}
				else
				{
					// No render method was found for this at all so throw a hissy fit
					throw new \InvalidArgumentException('Unable to find a render method for ' . get_class($element));
				}
			}
		}

		if ($is_container)
		{
			$this->csrfProvider->insertTokenPostRender($result);
		}

		return $result;
	}
public function render(Renderable $element)
	{
		// First get the name of the class
		$className = $this->getClassName($element);

		// Work out the function name to look for
		$functionName = static::$methodPrefix . $className;

		// Something to store the callable name in for later
		$callName = '';

		// TODO: find a cleaner way of doing this
		$is_container = $element instanceof Form;

		if ($is_container)
		{
			$this->csrfProvider->insertTokenPreRender($element);
		}

		// Check to see if our method is callable
		if (is_callable([$this, $functionName], false, $callName))
		{
			$result = $this->{$functionName}($element);
		}
		// If not callable then use the default function
		else
		{
			// Check for a generic fallback in the renderer

			$inputRenderFunction = static::$methodPrefix . 'Input';
			$inputRender = [$this, $inputRenderFunction];

			if (is_callable($inputRender))
			{
				$result = $this->$inputRenderFunction($element);
			}
			else
			{
				// Finally check if there is a render method in the object
				$elementRender = [$element, 'render'];

				if (is_callable($elementRender))
				{
					// If so call the render method
					$result = $element->render($this);
				}
				else
				{
					// No render method was found for this at all so throw a hissy fit
					throw new \InvalidArgumentException('Unable to find a render method for ' . get_class($element));
				}
			}
		}

		if ($is_container)
		{
			$this->csrfProvider->insertTokenPostRender($result);
		}

		return $result;
	}
public function render ( Renderable $ element ) { // First get the name of the class $ className = $ this -> getClassName ( $ element ) ; // Work out the function name to look for $ functionName = static :: $ methodPrefix . $ className ; // Something to store the callable name in for later $ callName = '' ; // TODO: find a cleaner way of doing this $ is_container = $ element instanceof Form ; if ( $ is_container ) { $ this -> csrfProvider -> insertTokenPreRender ( $ element ) ; } // Check to see if our method is callable if ( is_callable ( [ $ this , $ functionName ] , false , $ callName ) ) { $ result = $ this -> { $ functionName } ( $ element ) ; } // If not callable then use the default function else { // Check for a generic fallback in the renderer $ inputRenderFunction = static :: $ methodPrefix . 'Input' ; $ inputRender = [ $ this , $ inputRenderFunction ] ; if ( is_callable ( $ inputRender ) ) { $ result = $ this -> $ inputRenderFunction ( $ element ) ; } else { // Finally check if there is a render method in the object $ elementRender = [ $ element , 'render' ] ; if ( is_callable ( $ elementRender ) ) { // If so call the render method $ result = $ element -> render ( $ this ) ; } else { // No render method was found for this at all so throw a hissy fit throw new \ InvalidArgumentException ( 'Unable to find a render method for ' . get_class ( $ element ) ) ; } } } if ( $ is_container ) { $ this -> csrfProvider -> insertTokenPostRender ( $ result ) ; } return $ result ; }
This is the main render function that will work what function from the
subclass to call to render the given object.

Works out if there is a function that matches the element class name
to be able to magically add extra rendering functions.

@param \Fuel\Fieldset\Element $element

@return string
@throws \InvalidArgumentException

@since 2.0
This is the main render function that will work what function from the subclass to call to render the given object .