Project

General

Profile

Actions

Bug #83527

closed

ViewHelper call "Valid arguments are: additionalAttributes, data "

Added by Hans-Georg Althoff almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2018-01-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I have build a own Extension with customn ViewHelpers.

With 8.7.9 it works fine. With 9.0 I get the following error message:

Valid arguments are: additionalAttributes, data

I call the Viewhelper with:
<hga:listTable setup="{Setup}" />

Also with the inline version: {hga:listTable(setup:Setup)}

I get the same error message. I could not found any document, which describes a change between 8 and 9 for calling the ViewHelper.

Windows Server 2012R2 with IIS and PHP fastCGI 7.2

Actions #1

Updated by Georg Ringer almost 7 years ago

  • Status changed from New to Needs Feedback

Do able to identify the problem, can you please add your viewhelper code. thanks.

Actions #2

Updated by Hans-Georg Althoff almost 7 years ago

class ListTableViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper  {

 /**
     * Renders a list table with horizontal and vertical gleider
     *
     * @param array $setup the data to be render
     * @return string HTML code
     * @author Hans-Georg Althoff <hgalt@gmx.net>
     */
    public function render($setup) {
        $temp = '';
        error_log("-start ViewHelper-");
        //Headline 
        $temp .= "<div id='listTxt'>\n";
        switch($setup['Txt']){
            case "File":
                $temp .= \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('LLL:EXT:hgaxlfedit/Resources/Private/Language/locallang_db.xlf:lhFile', 'hgaxlfedit');
                $temp .= " ".$setup['xlfN'].":";
                break;
            case "llFile":
                $temp .= \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('LLL:EXT:hgaxlfedit/Resources/Private/Language/locallang_db.xlf:lhLlFile', 'hgaxlfedit');
                $temp .= " ".$setup['sLL'].":";
                break;
            case "llCheck":
                $temp .= \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('LLL:EXT:hgaxlfedit/Resources/Private/Language/locallang_db.xlf:lhLlCheck', 'hgaxlfedit');
                $temp .= " ".$setup['sLL'].":";
                break;
            case "llCheckT":
                $temp .= \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('LLL:EXT:hgaxlfedit/Resources/Private/Language/locallang_db.xlf:lhLlCheckT', 'hgaxlfedit');
                $temp .= " ".$setup['sLL'].":";
                break;

        }
        $temp .= "\n</div>\n";
        // List Box
        $value = $setup['xlf'];
        $iNum = count($value['items']);
        if($iNum != 0){
/*            $temp .= "<div style='width: 600px; border: 1px solid #bdbdbd;'>\n";
            $temp .= "<table class='Display' style=' border: 1px solid #bdbdbd; width: 100%; cellspacing: 0px; cellpadding: 1px; width: 100%; display:block; background: #fff;'>\n";
            $temp .= "<tr>\n<td>\n"; */
            $temp .= "<table id='header' class='List' style=' width: 100%; border: 1px solid #bdbdbd; cellspacing: 0px; cellpadding: 1px; display:block; background: #fff; font-family: sans-serif; font-size: 10pt;'> \n";
            $temp .= "\t<tr>\n";
            $temp .= "\t\t\t<th class = 'th1' style='text-align: left;'>";
            $temp .= "Unit";
            $temp .= "</th>\n";
            $temp .= "\t\t\t<th class = 'th2' style='text-align: left;'>";
            $temp .= "Source";
            $temp .= "</th>\n";
            $iTarget = strlen($value['target']);
            if( $iTarget> 1){
                $temp .= "\t\t\t<th class = 'th3' style='text-align: left;'>";
                $temp .= "Target";
                $temp .= "</th>\n";
            }
            $temp .= "</tr>\n";
            $temp .= "</table>\n";
/*            $temp .= "</td>\n</tr>\n";
            $temp .= "<td>\n<tr>\n";*/
            $temp .= "<div class='tXLF' style = 'overflow-y:auto; overflow-x:auto; height:200px; border: 1px solid #bdbdbd; ' >\n";
            $temp .= "<table id='tXLF' class='tXLF' style = 'width: 100%; background: #fff; display: block; cellspacing: 0px; cellpadding: 1px; font-family: sans-serif; font-size: 10pt;'> \n";
            if(count($value['items'])){
//                error_log(count($value['items'])."-ListViewHelper");
;                foreach ($value['items'] as $item){
                    $temp .= "<tr class = 'item'>\n";
                    $temp .= "<td class='unit' min-width='50'>";
                    $temp .= $item['unit'];
                    $temp .= "</td>\n<td class = 'source' min-width='50'>";
                    $temp .= $item['source'];
                    $temp .= "</td>\n";
                    if( $iTarget> 1){
                        $temp .= "<td class = 'target' >";
                        $temp .= $item['target'];
                        $temp .= "</td>\n";
                    }
                    $temp .= "</tr>\n";
                }
            }
            $temp .= "</table>\n";
            $temp .= "</div>\n";
/*            $temp .= "</td>\n</tr>\n</table>\n";
            $temp .="</div>\n";*/
//            error_log($temp."-ListTable"); 
        }elseif(strcmp($setup['Txt'], 'llCheckT') == 0){
            $temp  = "<div id='tXLF' class='boxed' style='border: 1px solid green; padding: 25px; background-color: LightGreen; font-size: 12px;'>\n<p><b>";
            $temp .= \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('LLL:EXT:hgaxlfedit/Resources/Private/Language/locallang_db.xlf:CheckTarget', 'hgaxlfedit');
            $temp .= "</b></p><br/><p>";
            $temp .= \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('LLL:EXT:hgaxlfedit/Resources/Private/Language/locallang_db.xlf:CheckSourceE', 'hgaxlfedit');
            $temp .= "</p>\n</div>\n";
//            error_log($temp."-ListTable ".$setup['Txt']); 
        }elseif(strcmp($setup['Txt'], 'llCheck') == 0){
            $temp  = "<div id='tXLF' class='boxed' style='border: 1px solid green; padding: 25px; background-color: LightGreen; font-size: 12px;'>\n<p> <b>    ";
            $temp .= \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('LLL:EXT:hgaxlfedit/Resources/Private/Language/locallang_db.xlf:CheckSource', 'hgaxlfedit');
            $temp .= "</b></p><br/><p>     ";
            $temp .= \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('LLL:EXT:hgaxlfedit/Resources/Private/Language/locallang_db.xlf:CheckSourceE', 'hgaxlfedit');
            $temp .= "</p>\n</div>\n";
//            error_log($temp."-ListTable ".$setup['Txt']); 
        }
    return $temp;
    }
}

Actions #3

Updated by Wouter Wolters almost 7 years ago

Hi Hans,

Your ViewHelper is not an AbstractTagBasedViewHelper. You should try to extend the ViewHelper from the AbstractViewHelper instead of the AbstractTagBasedViewHelper.

Furthermore I want to inform you that the render() method arguments is deprecated.
https://docs.typo3.org/typo3cms/extensions/core/Changelog/9.0/Deprecation-81213-RenderMethodArgumentOnViewHelpersDeprecated.html?highlight=render

Actions #4

Updated by Hans-Georg Althoff almost 7 years ago

Hi Wouter,

I have solved the render problem. Thanks for your help.

But if I using AbstractViewHelper I can only see the HTML source code in the backend, generated from the viewhelper,instead of the expected table.
With AbstractTagBasedViewHelper it is working as expected.
But with earlier versions of Typo3, this extension was also working with AbstractViewHelper!
What's could be get wrong?

Actions #5

Updated by Wouter Wolters almost 7 years ago

  • Status changed from Needs Feedback to Closed

That has to do with the automatic escaping of the return value of the ViewHelper code. You need to disable the escaping of the output. You can check the core ViewHelpers for examples. As this should be solved in your ViewHelper I close this as solved.

Actions

Also available in: Atom PDF