Compare commits
No commits in common. "21725f0f1e8a57bc1c8358a7910b0b750d5b8403" and "c83cb2622acb5ac8d3eb7fd7eea83b8a7acf59ed" have entirely different histories.
21725f0f1e
...
c83cb2622a
@ -123,9 +123,7 @@ trait ValidationTrait
|
|||||||
{
|
{
|
||||||
$validator = new Validator();
|
$validator = new Validator();
|
||||||
$input = ArrayUtility::removeEmptyStrings($input);
|
$input = ArrayUtility::removeEmptyStrings($input);
|
||||||
if (is_array($input) && array_key_exists('eID', $input)) {
|
|
||||||
unset($input['eID']);
|
unset($input['eID']);
|
||||||
}
|
|
||||||
//@TODO make optional when usiing rest api
|
//@TODO make optional when usiing rest api
|
||||||
//array_walk_recursive(
|
//array_walk_recursive(
|
||||||
// $input,
|
// $input,
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Cjel\TemplatesAide\ViewHelpers\Format;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please read the
|
|
||||||
* LICENSE.md file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
|
||||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
|
||||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithContentArgumentAndRenderStatic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ### Wordwrap: Wrap a string at provided character count
|
|
||||||
*
|
|
||||||
* Wraps a string to $limit characters and at $break character
|
|
||||||
* while maintaining complete words. Concatenates the resulting
|
|
||||||
* strings with $glue. Code is heavily inspired
|
|
||||||
* by Codeigniter's word_wrap helper.
|
|
||||||
*/
|
|
||||||
class WordWrapViewHelper extends AbstractViewHelper
|
|
||||||
{
|
|
||||||
use CompileWithContentArgumentAndRenderStatic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function initializeArguments()
|
|
||||||
{
|
|
||||||
$this->registerArgument('subject', 'string', 'Text to wrap');
|
|
||||||
$this->registerArgument('limit', 'integer', 'Maximum length of resulting parts after wrapping', false, 80);
|
|
||||||
$this->registerArgument('break', 'string', 'Character to wrap text at', false, PHP_EOL);
|
|
||||||
$this->registerArgument('glue', 'string', 'Character to concatenate parts with after wrapping', false, PHP_EOL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $arguments
|
|
||||||
* @param \Closure $renderChildrenClosure
|
|
||||||
* @param RenderingContextInterface $renderingContext
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public static function renderStatic(
|
|
||||||
array $arguments,
|
|
||||||
\Closure $renderChildrenClosure,
|
|
||||||
RenderingContextInterface $renderingContext
|
|
||||||
) {
|
|
||||||
$subject = $renderChildrenClosure();
|
|
||||||
$limit = (integer) $arguments['limit'];
|
|
||||||
$break = $arguments['break'];
|
|
||||||
$glue = $arguments['glue'];
|
|
||||||
$subject = preg_replace('/ +/', ' ', $subject);
|
|
||||||
$subject = str_replace(["\r\n", "\r"], PHP_EOL, $subject);
|
|
||||||
$subject = wordwrap($subject, $limit, $break, false);
|
|
||||||
$output = '';
|
|
||||||
foreach (explode($break, $subject) as $line) {
|
|
||||||
if (mb_strlen($line) <= $limit) {
|
|
||||||
$output .= $line . $glue;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$temp = '';
|
|
||||||
//while (mb_strlen($line) > $limit) {
|
|
||||||
// $temp .= mb_substr($line, 0, $limit - 1);
|
|
||||||
// $line = mb_substr($line, $limit - 1);
|
|
||||||
//}
|
|
||||||
if (false === empty($temp)) {
|
|
||||||
$output .= $temp . $glue . $line . $glue;
|
|
||||||
} else {
|
|
||||||
$output .= $line . $glue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,9 +20,9 @@
|
|||||||
### {row.data -> f:format.nl2br() -> f:format.raw()}
|
### {row.data -> f:format.nl2br() -> f:format.raw()}
|
||||||
</f:case>
|
</f:case>
|
||||||
<f:defaultCase>
|
<f:defaultCase>
|
||||||
<f:spaceless><c:format.wordWrap limit="76" glue="{br}">
|
<f:spaceless><v:format.wordWrap limit="76" glue="{br}">
|
||||||
{row.data -> f:format.raw()}
|
{row.data -> f:format.raw()}
|
||||||
</c:format.wordWrap>
|
</v:format.wordWrap>
|
||||||
</f:spaceless>{br}{br}
|
</f:spaceless>{br}{br}
|
||||||
</f:defaultCase>
|
</f:defaultCase>
|
||||||
</f:switch>
|
</f:switch>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user