ThomasKeil / pimcore-plugin-DynamicDropdown

Adds an input element to pimcore that gets it's data from object contents
Other
10 stars 8 forks source link

Pimcore - Dynamic Dropdown

License Latest Stable Version

Dynamic Dropdown allows you to populate pimcore input fields with the content of other objcts.

Interface

Getting started

or install it via composer on an existing pimcore installation

composer require thomas-keil/dynamic-dropdown

Configuring

The plugin doesn't require any configuration but provides several input elements. These input fields can be configured like any other of pimcore's input elements.

Usage

The plugin extends pimcores class data compent menu in the section "Select". Four new elements can be used:

Options

The options for all input elements are the same, only the way the information is presented differes.

Options

Following options need to be set:

Dynamic Dropdown

Dynamic Dropdown

The Dynamic Dropdown is the "classic" version of the provided input elements: a dropdown input field (ExtJS: Combobox). Every option is provided by an object in a configured folder, by a configured method. The folder can have nested subfolders, but only one type of object class can provide the data.

This input element extends pimcore's href element. Programatically, you can set it's value with the API like you'd do with a href.

Dynamic Dropdown (multiselect)

The multiselect Dynamic Dropdown is like the single select version, but you can select more than one item. It uses ExtJS' UX MultiSelect. It extends pimcore's multiselection. Setting it with the API is like working with a multiselection.

Itemselector

The Itemselector is like the Multiselect, but uses the ItemSelector as UI element.

SuperboxSelect

The SuperboxSelect is like the Multiselect, but uses the TagField as UI element.

Example

use Pimcore\Model\Object;

$myHrefElement = Document::getById(23);
$myOtherHrefElement = Document::getById(23);

$myMultihrefElements[] = $myHrefElement;
$myMultihrefElements[] = $myOtherHrefElement;

$myObjectsElements[] = Object\Product::getById(98);
$myObjectsElements[] = Object\Product::getById(99);

$object->setDynamicDropdown($myHrefElement);
$object->setDynamicDropdownMultiple($myMultihrefElements);
$object->setItemselector($myMultihrefElements);
$object->setSuperboxSelect($myMultihrefElements);

$object->save();