Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/benjaminkott/bk2k_collection

TYPO3 Extension
https://github.com/benjaminkott/bk2k_collection

Last synced: 3 months ago
JSON representation

TYPO3 Extension

Awesome Lists containing this project

README

        

BK2K Extbase / Fluid Collection
===============================
A collection of viewhelpers and other stuff.

## Content Elements

### SVG / Image Content Element
This is an example for an content element width extbase and fal.
... developing ...

## ViewHelpers

### Extbase.Plugin
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.

#### Example
```html
{namespace collection = BK2K\Bk2kCollection\ViewHelpers}

```
#### Attributes
| 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 |

### Format.RemoveBlankLines
ViewHelper to remove blank lines from output

#### Example
```html
{namespace collection = BK2K\Bk2kCollection\ViewHelpers}

-- random fluid/html stuff --

```

### Media.LastImageInfo
ViewHelper to get $GLOBALS['TSFE']->lastImageInfo accessible in the fluid template

#### Example
```html
{namespace collection = BK2K\Bk2kCollection\ViewHelpers}

{lastImageInfo}

```

### Page.Meta
ViewHelper to add a new or overriding an existing meta tag
#### Example
```html
{namespace collection = BK2K\Bk2kCollection\ViewHelpers}

```
#### Attributes
| 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 |

### Uri.Image
This extends viewhelper the default fluid uri image viewhelper to get absolute urls in the frontend.

#### Example
```html
{namespace collection = BK2K\Bk2kCollection\ViewHelpers}
{collection:uri.image(src:'uploads/tx_extension/{image}' maxWidth:'100', absolute: 1)}
```

#### Attributes
| 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 |

### View.SetPartialRootPath
ViewHelper to change the partialRootPath for a specific part of the fluid template.

#### Example
```html
{namespace collection = BK2K\Bk2kCollection\ViewHelpers}

```

#### Attributes
| Name | Type | Default value | Required |
|:--------------|:----------|:--------------|:----------|
| path | string | NULL | YES |

## Service

### MetaService
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.
##### Before
```html

```
##### After
```html

```
To get that work the service uses the render-postProcess hook to take operations.

### SitemapService
This service will generate an xml sitemap.
You need to include the static template.

#### Working Sitemap Example
```html
http://www.bk2k.info/sitemap.xml
```

##### Register Hook
```html
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['bk2k_collection']['service']['sitemap']['addPages'][] = 'EXT:'.$_EXTKEY.'/Classes/Hooks/Sitemap/AddPagesHook.php:vendorName\extensionName\Hooks\Sitemap\AddPagesHook->addPages';
```

##### Example Hook
```html
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;
}
}
```

## Dependencies
| Name | Version |
|:----------|:----------|
| extbase | 6.0 |
| fluid | 6.0 |
| typo3 | 6.0.2 |