Hallo,
Ich versuche eine URL ohne A Tag zu render.
Eigentlich müsste das mit den widget.uri funktionieren.
<f:widget.uri action="show" />
Leider bekomme ich eine Fehlermeldung aus der ich nicht wirklich schlau werde. #angry#
Fatal error: Call to undefined method Tx_Extbase_MVC_Web_Request::getArgumentPrefix()
Hat jemand eine Idee?
(oh ich hab gerade gesehen das ich im Falschen Forumszweig gepostet habe, sorry)
muss man irgendwas beachten wenn man ein Widget benutzt?
Habe sonst noch nie ein Widget eingesetzt. #paralyzed#
Im Widget gibt es folgende Code Zeile
$argumentPrefix = $this->controllerContext->getRequest()->getArgumentPrefix();
Der controllerContext ist vorhanden, das getRequest liefert auch was zurück nur das getArgumentPrefix funktioniert nicht. #evil#
Habe für mich eine Lösung gefunden und zwar hab ich den normalen action link Viewhelper genommen und minimal angepasst.
<?php
class Tx_DEINEXTENSIONNAME_ViewHelpers_UriViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper {
/**
* @var string
*/
protected $tagName = 'a';
/**
* Arguments initialization
*
* @return void
*/
public function initializeArguments() {
$this->registerUniversalTagAttributes();
$this->registerTagAttribute('name', 'string', 'Specifies the name of an anchor');
$this->registerTagAttribute('rel', 'string', 'Specifies the relationship between the current document and the linked document');
$this->registerTagAttribute('rev', 'string', 'Specifies the relationship between the linked document and the current document');
$this->registerTagAttribute('target', 'string', 'Specifies where to open the linked document');
}
/**
* @param string $action Target action
* @param array $arguments Arguments
* @param string $controller Target controller. If NULL current controllerName is used
* @param string $extensionName Target Extension Name (without "tx_" prefix and no underscores). If NULL the current extension name is used
* @param string $pluginName Target plugin. If empty, the current plugin name is used
* @param integer $pageUid target page. See TypoLink destination
* @param integer $pageType type of the target page. See typolink.parameter
* @param boolean $noCache set this to disable caching for the target page. You should not need this.
* @param boolean $noCacheHash set this to supress the cHash query parameter created by TypoLink. You should not need this.
* @param string $section the anchor to be added to the URI
* @param string $format The requested format, e.g. ".html"
* @param boolean $linkAccessRestrictedPages If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.
* @param array $additionalParams additional query parameters that won't be prefixed like $arguments (overrule $arguments)
* @param boolean $absolute If set, the URI of the rendered link is absolute
* @param boolean $addQueryString If set, the current query parameters will be kept in the URI
* @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = TRUE
* @return string Rendered link
*/
public function render($action = NULL, array $arguments = array(), $controller = NULL, $extensionName = NULL, $pluginName = NULL, $pageUid = NULL, $pageType = 0, $noCache = FALSE, $noCacheHash = FALSE, $section = '', $format = '', $linkAccessRestrictedPages = FALSE, array $additionalParams = array(), $absolute = FALSE, $addQueryString = FALSE, array $argumentsToBeExcludedFromQueryString = array()) {
$uriBuilder = $this->controllerContext->getUriBuilder();
$uri = $uriBuilder
->reset()
->setTargetPageUid($pageUid)
->setTargetPageType($pageType)
->setNoCache($noCache)
->setUseCacheHash(!$noCacheHash)
->setSection($section)
->setFormat($format)
->setLinkAccessRestrictedPages($linkAccessRestrictedPages)
->setArguments($additionalParams)
->setCreateAbsoluteUri($absolute)
->setAddQueryString($addQueryString)
->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)
->uriFor($action, $arguments, $controller, $extensionName, $pluginName);
$this->tag->addAttribute('href', $uri);
$this->tag->setContent($this->renderChildren());
$this->tag->forceClosingTag(TRUE);
return $uri;
}
}
?>
Habe eigentlich nur direkt die $uri Variable geturnt und nicht das tag.
Naja es tut auf jeden Fall was es soll und zwar nur die Nackte URL rausrücken :p
Danke fürs zuhören 😉
Hab gerade gesehen das es genau den ViewHelper schon gibt.
<f:uri:action...
#angry##angry##angry##angry##angry##angry##angry##angry#