Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Icons for Objects Variants #4501

Open
Pierre-Datasolution opened this issue Jun 10, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@Pierre-Datasolution
Copy link

commented Jun 10, 2019

Hi Pimcore team,

Bug Report

Pimcore 5.8.4
Custom Icons for Objects Variants (seems to work well on objects)
but not on variants)
CustomIconStyle for Variants.pdf

Expected behavior

Custom Icon should be used in object tree AND object panel view (see in attached file)

Actual behavior

Custom icon is only used by variant object panel view. Default variant icon is used in tree

Steps to reproduce

Create an object class with variants (in my case ModeleVoiture)
Create an object (in my case Captur)
Create a variant of the object (in my case Captur TCe 130 FAP)
Define custom icon and style in object tree following [https://pimcore.com/docs/5.x/Development_Documentation/Objects/Object_Classes/Class_Settings/Custom_Icons.html]

Code example


namespace AppBundle\Model\DataObject;

use AppBundle\Admin\AdminStyle;

class ModeleVoiture extends \Pimcore\Model\DataObject\ModeleVoiture
{
    public function __construct()
    {
        parent::__construct();
    }

    public function getElementAdminStyle() {
        if (!$this->o_elementAdminStyle) {
            $this->o_elementAdminStyle = new AdminStyle($this);
        }
        return $this->o_elementAdminStyle;
    }
}


namespace AppBundle\Admin;

use AppBundle\Model\DataObject\ModeleVoiture;

class AdminStyle extends \Pimcore\Model\Element\AdminStyle {

    private $element;

    public function __construct($element) {

        $this->element = $element;

        parent::__construct($element);

        if(($element instanceof ModeleVoiture) && ($element->getType() == "variant")) {
                $this->setElementIcon('/bundles/app/img/flat-color-icons/automotive.svg');
                $this->setElementIconClass(null);
        }
    }
}

Feature Request

Feature description

Icon of variant in object tree should be the same as object view panel

Hope I used it correctly and it is a real bug
Thanks for your help
Pierre

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.