object-access
Class:
\CPSIT\
Resolves a property (or nested property path) from an object and stores the resulting value in the processed data. This is useful for pulling individual properties out of an Extbase domain object (or any other object) that was placed into the data processing chain by a preceding processor or controller, without having to expose the whole object to the template.
Data sources
object
is resolved exactly like
data on
process-each — see Resolving a data payload (dataSource / data)
for the full syntax, including what happens when multiple references are
configured. It just uses a processor-specific option name instead of the
generic
data.
object. uses the
content object's current value instead (see
Using the content object's current value).
This is what allows
object
to refer to a value placed into
processed by a preceding processor's
as
option, or to a variable an Extbase controller assigned directly to the
view (Extbase-assigned view variables end up in
processed
too, under the assigned key).
Usage
data also runs for Extbase plugins whose controller
extends HandlebarsController, since
Handlebars
renders through the same
HANDLEBARSTEMPLATE
content object under
the hood. An action that assigns a domain object to the view makes that object
available to
object- under the assigned key:
final class BlogController extends HandlebarsController
{
public function showAction(Post $post): ResponseInterface
{
$this->view->assign('post', $post);
return $this->htmlResponse($this->renderView());
}
}
plugin.tx_myextension_blog.handlebars {
Blog::show {
dataProcessing {
# Pull the related category's title off the assigned "post" object
10 = object-access
10 {
object = processedData:post
path = category.title
as = categoryTitle
}
}
}
}
Properties
object- Data source reference(s) the source object is read from (see Data sources). Required.
path- Property path passed to
TYPO3Fluid\. Supports plain property names as well as dot-separated nested paths (e.g.Fluid\ Core\ Variables\ Standard Variable Provider:: get By Path () category.). Required.title as- Target key in the processed data array the resolved value is stored
under. Default:
result.
If
object
is not configured, or the resolved value is not an
object, or
path
is missing, or
path
is not a
gettable property on the resolved object, a warning is logged and the
processed data is returned unchanged.
When the resolved value is itself an array, it is run through the standard
TYPO3
data chain configured on this processor, just
like TYPO3's own
menu
or
database-
processors do for their items.