本文整理匯總了PHP中Drupal\Core\Render\RendererInterface::method方法的典型用法代碼示例。如果您正苦於以下問題:PHP RendererInterface::method方法的具體用法?PHP RendererInterface::method怎麽用?PHP RendererInterface::method使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Drupal\Core\Render\RendererInterface
的用法示例。
在下文中一共展示了RendererInterface::method方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUpUrlIntegrationServices
/**
* Sets up the unrouted url assembler and the link generator.
*/
protected function setUpUrlIntegrationServices()
{
$this->pathProcessor = $this->getMock('Drupal\\Core\\PathProcessor\\OutboundPathProcessorInterface');
$this->unroutedUrlAssembler = new UnroutedUrlAssembler($this->requestStack, $this->pathProcessor);
\Drupal::getContainer()->set('unrouted_url_assembler', $this->unroutedUrlAssembler);
$this->linkGenerator = new LinkGenerator($this->urlGenerator, $this->getMock('Drupal\\Core\\Extension\\ModuleHandlerInterface'), $this->renderer);
$this->renderer->method('render')->willReturnCallback(function (&$elements, $is_root_call = FALSE) {
// Mock the ability to theme links
$link = $this->linkGenerator->generate($elements['#title'], $elements['#url']);
if (isset($elements['#prefix'])) {
$link = $elements['#prefix'] . $link;
}
if (isset($elements['#suffix'])) {
$link = $link . $elements['#suffix'];
}
return Markup::create($link);
});
}