Lack of interest Formatter_Base Workflows

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

xf_phantom

Well-known member
It would be great, if the renderMethods from the formatter (renderTagAttach, renderTagCode,..) wouldn't return the rendered template.
It's impossible to change the used templatename or add own variables to the template without overwriting the complete method. (=> addon conflics)
 
Last edited:
Upvote 0
This suggestion has been closed. Votes are no longer accepted.
A quick solution would be a simple wrapper function like
PHP:
  protected function _getRenderedTemplate($templateName,array $params){
  $template = $this->_view->createTemplateObject($templateName, $params);
  return $template->render();
  }

  public function renderTagFoo(array $tag, array $rendererStates){

  $viewParams = array(
  'foo' =>1
  );
  return $this->_getRenderedTemplate('foo',$viewParams);
  }

then addons would have access to the templatename and variables

PHP:
  protected function _getRenderedTemplate($templateName,array $params){

  if (XenForo_Application::isRegistered('myuniquekey')){
  $params += XenForo_Application::get('myuniquekey');
  }
  return parent::_getRenderedTemplate($templateName, $params);
  }

  public function renderTagFoo(array $tag, array $rendererStates){
  if (foo()){
  XenForo_Application::set('myuniquekey',array('foo' => 'baz'));
  }
  return parent::renderTagFoo($tag,$rendererStates);
  }
 
Top Bottom