Pimcore Studio Backend allows you to add additional data to response schemas.
Every response schema implements the AdditionalAttributesInterface and AdditionalAttributesTrait which allows you to add additional attributes to the schema.
Similarly to the additional attributes, you can also add custom attributes to the schema. These attributes contain mainly data used for the tree customization.
Therefore as default, the custom attributes are available for the tree response schema.
If you want to add custom attributes to another schema, you need to implement the CustomAttributesTrait in the schema.
You need to register a subscriber to that specific schema where you can add the additional data.
Every schema implements its own event that you can subscribe to.
Every event implements the AbstractPreResponseEvent which allows to add the actual data, but also makes it possible to get the actual Schema out of the event with a type safe getter.
For an example see Extending Events.
<?php
declare(strict_types=1);
namespace App\Asset\Event\PreResponse;
use Pimcore\Bundle\StudioBackendBundle\Asset\Schema\Asset;
use Pimcore\Bundle\StudioBackendBundle\Element\Schema\CustomAttributes;
use Pimcore\Bundle\StudioBackendBundle\Event\AbstractPreResponseEvent;
final class AssetEvent extends AbstractPreResponseEvent
{
public const EVENT_NAME = 'pre_response.asset';
public function __construct(
private readonly Asset $asset
) {
parent::__construct($asset);
}
/**
* Use this to get additional infos out of the response object
*/
public function getAsset(): Asset
{
return $this->asset;
}
public function getCustomAttributes(): ?CustomAttributes
{
return $this->asset->getCustomAttributes();
}
public function setCustomAttributes(CustomAttributes $customAttributes): void
{
$this->asset->setCustomAttributes($customAttributes);
}
}icon- The custom icon that should be displayed in the tree.tooltip- The custom HTML tooltip to be displayed in the tree.additionalIcons- Array of additional icons that should be displayed in the tree.key- The key that should be displayed in the tree.additionalCssClasses- Additional CSS classes that should be added to the tree element.
asset.deletedata_object.deletedocument.deletepre_response.all_layouts.collectionpre_response.assetpre_response.asset_custom_metadatapre_response.asset_custom_settingspre_response.asset_predefined_metadatapre_response.asset_versionpre_response.bundle_application_logger.listpre_response.bundle_seo.redirect.import_statspre_response.bundle_seo.redirect.listpre_response.bundle_seo.redirect.statuspre_response.class_definitionpre_response.class_definition.collectionpre_response.class_definition.folder.collectionpre_response.classification_store.collectionpre_response.classification_store.grouppre_response.classification_store.group_layoutpre_response.classification_store.key_group_relationpre_response.custom_layoutpre_response.custom_layout.collectionpre_response.custom_report_chart_datapre_response.custom_report_reportpre_response.custom_report_tree_config_nodepre_response.custom_report_tree_nodepre_response.custom_report.column_informationpre_response.data_objectpre_response.data_object_detailpre_response.data_object.dynamic_select_optionpre_response.data_object.formated_pathpre_response.data_object.layoutpre_response.data_object_versionpre_response.dependencypre_response.documentpre_response.document.doc_typepre_response.document.doc_type.typepre_response.document.get_translationspre_response.document.get_translation;parentpre_response.document.list_available_controllerspre_response.document.list_available_templatespre_response.document.page-snippet.render-area-block-editmodepre_response.document.site.detailpre_response.document.sites_list_availablepre_response.document_versionpre_response.email.blocklist.entrypre_response.email.log.detailpre_response.email.log.detail.paramspre_response.email.logList.entrypre_response.element.context_permissionspre_response.element_locatepre_response.element_propertypre_response.element_subtypepre_response.execution_engine.list_running_job_runspre_response.field_collection.layout_definitionpre_response.grid_column_configurationpre_response.grid_column_datapre_response.grid_configurationpre_response.grid_detailed_configurationpre_response.list_thumbnailpre_response.notificationpre_response.notification.list.itempre_response.notepre_response.note.typepre_response.objectBrick.layout_definitionpre_response.perspective.config.getpre_response.perspective.widget.config.getpre_response.perspective.widget.typepre_response.predefined_propertypre_response.quantity_value.unit.conversion_collectionpre_response.quantity_value.unit_listpre_response.recycle_bin.itempre_response.role_tree_nodepre_response.schedulepre_response.settings.active_bundlepre_response.simple_search.previewpre_response.simple_search.resultpre_response.simple_userpre_response.tagpre_response.translationspre_response.translations.import.csv-settingspre_response.userpre_response.user_detailed_rolepre_response.user_informationpre_response.user_permissionpre_response.user_simple_rolepre_response.user_tree_nodepre_response.versionpre_response.website_settings.itempre_response.workflow_detailspre_response.notification_recipientpre_response.php_code_transformerpre_response.data_providerpre_response.element.usage.itempre_response.element.usage