Project

General

Profile

Actions

Bug #65435

closed

Error fatal when using RecordListHookInterface

Added by Eric Chavaillaz almost 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Backend API
Target version:
Start date:
2015-03-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

Hi,

If I try to use the hook in the makeControl method (in typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php) by setting the interface RecordListHookInterface, I have an error fatal thrown when showing the list module :

 #1: PHP Warning: Invalid argument supplied for foreach() in .../typo3/httpdocs/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php line 1406
TYPO3\CMS\Core\Error\Exception thrown in file .../typo3/httpdocs/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 102.

7 TYPO3\CMS\Core\Error\ErrorHandler::handleError(2, "Invalid argument supplied for foreach()", ".../typo3/httpdocs/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php", 1406, array)

...typo3/httpdocs/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php:
01404:     // before calling the hook
01405:     foreach ($cells as $section => $actions) {
01406:      foreach ($actions as $actionKey => $action) {
01407:       $cells[$actionKey] = $action;
01408:      }

I think it's a regression when the "primary" and "secondary" sub-key were introduced.

By the way, in my hook I just return the value to test it.

Thanks!

Actions #1

Updated by Nicole Cordes almost 10 years ago

  • Status changed from New to Needs Feedback

This warning is only triggered if the return from the hook isn't an array. Could you please check or provide your class and its returns.

Actions #2

Updated by Eric Chavaillaz almost 10 years ago

Perhaps it comes from the EXT:gridelements who hooks also here.
I will check it and give a feedback when I know more.

Thanks to take care!

Actions #3

Updated by Eric Chavaillaz almost 10 years ago

Ok, so the bug comes in several condition :

1) gridelements must be loaded
2) the feature "basic.nestingInListModule" from the extension configuration must NOT be set to true.
3) Additionally basic hook must be implemented with the interface RecordListHookInterface.

The basic hook :

<?php

namespace Vendor\MyExt\Hooks;

class DatabaseRecordListHook implements RecordListHookInterface {
    /**
     * Modifies Web>List clip icons (copy, cut, paste, etc.) of a displayed row
     *
     * @param string $table The current database table
     * @param array $row The current record row
     * @param array $cells The default clip-icons to get modified
     * @param object $parentObject Instance of calling object
     * @return array The modified clip-icons
     */
    public function makeClip($table, $row, $cells, &$parentObject) {
        return $cells;
    }

    /**
     * Modifies Web>List control icons of a displayed row
     *
     * @param string $table The current database table
     * @param array $row The current record row
     * @param array $cells The default control-icons to get modified
     * @param object $parentObject Instance of calling object
     * @return array The modified control-icons
     */
    public function makeControl($table, $row, $cells, &$parentObject) {
        return $cells;
    }

    /**
     * Modifies Web>List header row columns/cells
     *
     * @param string $table The current database table
     * @param array $currentIdList Array of the currently displayed uids of the table
     * @param array $headerColumns An array of rendered cells/columns
     * @param object $parentObject Instance of calling (parent) object
     * @return array Array of modified cells/columns
     */
    public function renderListHeader($table, $currentIdList, $headerColumns, &$parentObject) {
        return $headerColumns;
    }

    /**
     * Modifies Web>List header row clipboard/action icons
     *
     * @param string $table The current database table
     * @param array $currentIdList Array of the currently displayed uids of the table
     * @param array $cells An array of the current clipboard/action icons
     * @param object $parentObject Instance of calling (parent) object
     * @return array Array of modified clipboard/action icons
     */
    public function renderListHeaderActions($table, $currentIdList, $cells, &$parentObject) {
        return $cells;
    }
}

So finally the bug comes probably from gridelements.
I will open an issue in the good bug tracker.

Thanks

Actions #4

Updated by Georg Ringer over 9 years ago

  • Status changed from Needs Feedback to Closed

closed as this is not an issue of the core

Actions

Also available in: Atom PDF