Created
October 9, 2015 10:24
-
-
Save mneuhaus/26b54e0698d0f8c644a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Famelo\Soup\ViewHelpers; | |
/* | |
* This file belongs to the package "TYPO3 Fluid". | |
* See LICENSE.txt that was shipped with this package. | |
*/ | |
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; | |
/** | |
* | |
* @api | |
*/ | |
class BlockViewHelper extends AbstractViewHelper { | |
/** | |
* @var boolean | |
*/ | |
protected $escapeOutput = FALSE; | |
/** | |
* @return void | |
*/ | |
public function initializeArguments() { | |
parent::initializeArguments(); | |
$this->registerArgument('partial', 'string', 'Partial to render, with or without section'); | |
$this->registerArgument('arguments', 'array', 'Array of variables to be transferred. Use {_all} for all variables', FALSE, array()); | |
} | |
/** | |
* Renders the content. | |
* | |
* @return string | |
* @api | |
*/ | |
public function render() { | |
$partial = $this->arguments['partial']; | |
$arguments = (array) $this->arguments['arguments']; | |
$arguments['content'] = $this->renderChildren(); | |
return $this->viewHelperVariableContainer->getView()->renderPartial($partial, NULL, $arguments); | |
} | |
/** | |
* @param array $arguments | |
* @return void | |
*/ | |
public function handleAdditionalArguments(array $arguments) { | |
$this->arguments['arguments'] = array_replace( | |
$this->arguments['arguments'], | |
$arguments | |
); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="card card-expandable depth-2"> | |
<div class="card-header"> | |
{header} | |
</div> | |
<div class="card-body"> | |
{content->f:format.raw()} | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<s:block partial="Card" header="Some Header"> | |
lorem ipsum dolor set amet | |
</s:block> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment