function PreExportEvent::setCallback
Sets the export callback for a specific field name or data type.
Parameters
string $name_or_data_type: A field name or field item data type, like `field_item:image`. If the callback should run for every field a given type, this should be prefixed with `field_item:`, which is the Typed Data prefix for field items. If there is no prefix, this is treated as a field name.
callable $callback: The callback which should export items of the specified field type. See the class documentation for details.
File
-
core/
lib/ Drupal/ Core/ DefaultContent/ PreExportEvent.php, line 101
Class
- PreExportEvent
- Event dispatched before an entity is exported as default content.
Namespace
Drupal\Core\DefaultContentCode
public function setCallback(string $name_or_data_type, callable $callback) : void {
$this->callbacks[$name_or_data_type] = $callback;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.