A collection of viewhelpers and other stuff.
This is an example for an content element width extbase and fal. ... developing ...
ViewHelper to output any extbase plugin directly called in the fluid template. If your extension uses the namespaces for 6.0 you have to set the vendor.
{namespace collection = BK2K\Bk2kCollection\ViewHelpers}
<collection:extbase.plugin vendor="Bk2k" extension="ExtensionName" plugin="PluginName" controller="Controller" action="Action" arguments="{settings: '{singlePid: 10}'}" />
Name | Type | Default value | Required |
---|---|---|---|
vendor | string | NULL | NO |
extension | string | NULL | YES |
plugin | string | NULL | YES |
controller | string | NULL | YES |
action | string | NULL | YES |
arguments | array | NULL | NO |
ViewHelper to remove blank lines from output
{namespace collection = BK2K\Bk2kCollection\ViewHelpers}
<collection:format.removeBlankLines>
-- random fluid/html stuff --
</collection:format.removeBlankLines>
ViewHelper to get $GLOBALS['TSFE']->lastImageInfo accessible in the fluid template
{namespace collection = BK2K\Bk2kCollection\ViewHelpers}
<f:image src="{src}" alt="{alt}" maxWidth="480" />
<collection:media.lastImageInfo>
<f:debug>{lastImageInfo}</f:debug>
</collection:media.lastImageInfo>
ViewHelper to add a new or overriding an existing meta tag
{namespace collection = BK2K\Bk2kCollection\ViewHelpers}
<collection:page.meta name="description" content="Insert random description here" />
Name | Type | Default value | Required |
---|---|---|---|
content | string | NULL | YES |
name | string | NULL | NO |
property | string | NULL | NO |
scheme | string | NULL | NO |
httpEnquiv | string | NULL | NO |
lang | string | NULL | NO |
This extends viewhelper the default fluid uri image viewhelper to get absolute urls in the frontend.
{namespace collection = BK2K\Bk2kCollection\ViewHelpers}
{collection:uri.image(src:'uploads/tx_extension/{image}' maxWidth:'100', absolute: 1)}
Name | Type | Default value | Required |
---|---|---|---|
src | string | NULL | YES |
width | string | NULL | NO |
height | string | NULL | NO |
minWidth | integer | NULL | NO |
minHeight | integer | NULL | NO |
maxWidth | integer | NULL | NO |
maxHeight | integer | NULL | NO |
absolute | boolean | FALSE | NO |
ViewHelper to change the partialRootPath for a specific part of the fluid template.
{namespace collection = BK2K\Bk2kCollection\ViewHelpers}
<collection:view.setPartialRootPath path="fileadmin/partials/">
<f:render partial="name" />
</collection:view.setPartialRootPath>
Name | Type | Default value | Required |
---|---|---|---|
path | string | NULL | YES |
This service will handle all additions by the page.meta viewhelper and merges them with previous rendered tags by TYPO3. It also cleans up double meta tag definitions and orders them alphabetical.
<meta property="og:site_name" content="site_name">
<meta name="description" content="description 1">
<meta property="og:title" content="title">
<meta name="description" content="description 2">
<meta name="author" content="authorname">
<meta name="author" content="authorname">
<meta name="description" content="description 2">
<meta property="og:site_name" content="site_name">
<meta property="og:title" content="title">
To get that work the service uses the render-postProcess hook to take operations.
This service will generate an xml sitemap. You need to include the static template.
http://www.bk2k.info/sitemap.xml
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['bk2k_collection']['service']['sitemap']['addPages'][] = 'EXT:'.$_EXTKEY.'/Classes/Hooks/Sitemap/AddPagesHook.php:vendorName\extensionName\Hooks\Sitemap\AddPagesHook->addPages';
class AddPagesHook implements \TYPO3\CMS\Core\SingletonInterface {
/**
* @param int $uid
* @return string
*/
public function getUrlById($uid){
$config = array(
'parameter' => $uid,
'returnLast' => 'url',
'additionalParams' => '',
'forceAbsoluteUrl' => TRUE
);
return $GLOBALS['TSFE']->cObj->typoLink('', $config);
}
/**
* @param array $_params
* @param \BK2K\Bk2kCollection\Service\SitemapService $pObj
*/
public function addPages($_params, $pObj){
$loc = $this->getUrlById('1');
$page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('BK2K\Bk2kCollection\Object\Sitemap\Page');
$page->setLoc($loc);
$page->setLastmod(date());
$_params['urlCollection'][$loc] = $page;
}
}
Name | Version |
---|---|
extbase | 6.0 |
fluid | 6.0 |
typo3 | 6.0.2 |