PHP code example of pimcore / output-data-config-toolkit-bundle

1. Go to this page and download the library: Download pimcore/output-data-config-toolkit-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pimcore / output-data-config-toolkit-bundle example snippets



    return [
        "channels" => [
            "channel1",
            "channel2",
            "mychannel1",
            "mychannel2"
        ]
    ];



    // returns the output data structure for the given product and the output channel productdetail_specification
    $specificationOutputChannel =  OutputDataConfigToolkitBundle\Service::getOutputDataConfig($product, "productdetail_specification");

    //printing output channel in view script with view-helper
    foreach($specificationOutputChannel as $property) {
        $this->productListSpecification($property, $this->product);
    }


namespace OutputDataConfigToolkitBundle\ConfigElement\Operator;

class RemoveZero extends AbstractOperator {


    public function __construct($config, $context = null) {
        parent::__construct($config, $context);
    }

    public function getLabeledValue($object) {
        $childs = $this->getChilds();
        if($childs[0]) {

            $value = $childs[0]->getLabeledValue($object);
            $value->value = $value->value == 0 ? null : $value->value;

            return $value;
        }
        return null;
    }

}

$config = new \OutputDataConfigToolkitBundle\ConfigAttribute\Value\DefaultValue();
$config->applyDefaults(); // datatype, type, class
$config->applyFromClassificationKeyConfig($keyConfig);

// create definition for channel and add value 
$newConfig = new \OutputDataConfigToolkitBundle\OutputDefinition();
$newConfig->setChannel("my_channel");
$newConfig->setClassId($classId);
$newConfig->setObjectId(12345);
$newConfig->setConfiguration($serializer->serialize($config, 'json'));
$newConfig->save();
sql
RENAME TABLE plugin_outputdataconfigtoolkit_outputdefinition TO bundle_outputdataconfigtoolkit_outputdefinition; 
sql
UPDATE users_permission_definitions SET `key` = REPLACE(`key`, 'plugin_outputDataConfigToolkit', 'bundle_outputDataConfigToolkit');
UPDATE users SET permissions = REPLACE(`permissions`, 'plugin_outputDataConfigToolkit', 'bundle_outputDataConfigToolkit');