Extract the Widget attributes from a Data Container array
public static getAttributesFromDca ( array $arrData, string $strName, mixed $varValue = null, string $strField = '', string $strTable = '', |
||
$arrData | array | The field configuration array |
$strName | string | The field name in the form |
$varValue | mixed | The field value |
$strField | string | The field name in the database |
$strTable | string | The table name in the database |
$objDca | An optional DataContainer object | |
return | array | An attributes array that can be passed to a widget |
/** * Handle the widget preparation. * * @param GetAttributesFromDcaEvent $event The event. * * @return void */ public function handleGetAttributesFromDca(GetAttributesFromDcaEvent $event) { $event->setResult(Widget::getAttributesFromDca($event->getFieldConfiguration(), $event->getWidgetName(), $event->getValue(), $event->getWidgetId(), $event->getTable(), $event->getDataContainer())); }
/** * Convert a DCA file configuration to be used with widgets * * @param array $arrData The field configuration array * @param string $strName The field name in the form * @param mixed $varValue The field value * @param string $strField The field name in the database * @param string $strTable The table name * * @return array An array that can be passed to a widget * * @deprecated Deprecated since Contao 4.0, to be removed in Contao 5.0. * Use Widget::getAttributesFromDca() instead. */ protected function prepareForWidget($arrData, $strName, $varValue = null, $strField = '', $strTable = '') { trigger_error('Using Controller::prepareForWidget() has been deprecated and will no longer work in Contao 5.0. Use Widget::getAttributesFromDca() instead.', E_USER_DEPRECATED); return \Widget::getAttributesFromDca($arrData, $strName, $varValue, $strField, $strTable); }