Important: #108813 - Record icons accept record objects
See forge#108813
Description
Rendering the icon of a record required a plain database row and its table name.
Code already working with objects implementing
\TYPO3\ had to rebuild an array just to
render an icon, although such a record already knows its own table.
\TYPO3\ therefore provides a new method
get, which takes the record object instead of a
table name and a row:
// Plain database row
$icon = $iconFactory->getIconForRecord('tt_content', $row, IconSize::SMALL);
// Record object
$icon = $iconFactory->getIconForRecordObject($record, IconSize::SMALL);
The Fluid ViewHelper
<core: gained a new argument
record
, which is interchangeable with
row
. Both accept a plain
database row as well as a record object, and exactly one of them must be given.
The argument
table
is no longer mandatory: it is required for row
arrays only and is not evaluated for record objects.
<core:iconForRecord table="tt_content" row="{CType: item.CType}" />
<core:iconForRecord record="{record}" />
The record's raw database row is used to determine both the type icon and the status overlays, so overlays for disabled or scheduled records are rendered the same way as for a plain row array.
Impact
Existing usages with a table name and a plain array continue to work unchanged. Extension authors can now pass record objects directly, which is the recommended way when the surrounding code already works with records.