Current data is mostly set automatically by the SDK, based on the particular structure and DataLocator
s of the content in question, but it can also be provided using the Scrivito.
ContentTag
component with a dataContext
prop.
DataItem
from the current data.Current data is mostly set automatically by the SDK, based on the particular structure and DataLocator
s of the content in question, but it can also be provided using the Scrivito.
ContentTag
component with a dataContext
prop.
Params
[New in 1.44.0]dataClassName
(String
) – Optional data class name. If the class name is specified, the current data is searched for the first DataItem
with the given class name. If no such DataItem
can be found in the current data, the global data (provided via provideDataItem
) is searched.
Returns
DataItem
or undefined
– The closest DataItem
from the current data. If no current data is available or if the current data contains no data items (i.e., only data scopes), undefined
is returned.
[New in 1.46.0] If the class name is given, the current data – including the object data of the current page and its ancestors – is searched for the first DataItem
with the given class name. If no such DataItem
can be found in the current data, a matching global DataItem
(via provideDataItem
) is returned if it exists. Otherwise undefined
is returned.