Skip to main content
Version: 2024.3

Create a Custom Backend Adapter

To create a custom backend adapter, you need to follow two steps:

  1. Create a new PHP class for your custom backend adapter;
  2. Add the adapter class to the mapping.

Create the PHP Class

You must define getAdapterValues function that return the adapter's value while extending \Pimcore\Bundle\BackendPowerToolsBundle\Adapter\AlternativeElementTree\AbstractObjectAdapter:

<?php 

namespace App\Adapter\AlternativeElementTree;

class CustomAdapter extends \Pimcore\Bundle\BackendPowerToolsBundle\Adapter\AlternativeElementTree\AbstractObjectAdapter
{
// start implementing
public function getAdapterValues(): ?string
{
...
}
}

Add the Adapter Type to the Mapping

The last step is to add the adapter type to the mapping. This can be done in the config.yaml of your bundle.

pimcore_backend_power_tools:
pimcore_alternative_object_trees:
adapters:
input: #= the datatype of the corresponding class field
frontend: SimpleValueAdapter
backend: App\Adapter\AlternativeElementTree\CustomAdapter