|
| 1 | +# Advanced Custom Layout Bundle |
| 2 | + |
| 3 | +Configure and create custom layouts without drag and drop. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +``` |
| 8 | +composer require basilicom/pimcore-advanced-custom-layout-bundle --dev |
| 9 | +``` |
| 10 | + |
| 11 | +Add a new configuration file `config/packages/custom_layouts.yaml`. |
| 12 | +An example configuration can be found in `config/packages/example.custom_layouts.yaml`. |
| 13 | + |
| 14 | +## Configuration |
| 15 | + |
| 16 | +``` |
| 17 | +Pimcore\Model\DataObject\TestObject: |
| 18 | + # layouts |
| 19 | + custom_layout: |
| 20 | + label: "My custom layout" |
| 21 | + mode: !php/const Basilicom\AdvancedCustomLayoutBundle\Model\CustomLayoutConfig::MODE_EDIT |
| 22 | + auto_apply_roles: [] |
| 23 | + auto_apply_workflow_states: [] |
| 24 | + fields: |
| 25 | + title: |
| 26 | + title: "Overwritten Titel" |
| 27 | + editable: false |
| 28 | + visible: false |
| 29 | +``` |
| 30 | + |
| 31 | +- `Pimcore\Model\DataObject\TestObject:` is the class name of the object you want to configure the custom layout for. |
| 32 | +- `custom_layout` is the name of the custom layout. You can define multiple custom layouts for one class. |
| 33 | +- `label` is the label of the custom layout which will be displayed in the object edit mode. |
| 34 | +- `mode` is the mode of the custom layout. See below for more information. |
| 35 | +- `auto_apply_roles` is an array of roles which will automatically apply this custom layout. |
| 36 | +- `auto_apply_workflow_states` is an array of workflow states which will automatically apply this custom layout. |
| 37 | +- `fields` is an array of fields which will be used for this custom layout. |
| 38 | +- `fields.title` is the name of the field. |
| 39 | +- `fields.title.title` is the new label of the field which will be displayed in the object edit mode. |
| 40 | +- `fields.title.editable` is a boolean value which defines if the field is editable or not. |
| 41 | +- `fields.title.visible` is a boolean value which defines if the field is visible or not. |
| 42 | + |
| 43 | +## Custom Layout Modes |
| 44 | + |
| 45 | +### Edit Mode |
| 46 | + |
| 47 | +A custom layout with this setting will consist of all fields of the layout definition. |
| 48 | +The provided settings will then overwrite the default settings. |
| 49 | + |
| 50 | +``` |
| 51 | +Pimcore\Model\DataObject\TestObject: |
| 52 | + # layouts |
| 53 | + custom_layout: |
| 54 | + label: "My custom layout" |
| 55 | + mode: !php/const Basilicom\AdvancedCustomLayoutBundle\Model\CustomLayoutConfig::MODE_EDIT |
| 56 | + fields: |
| 57 | + title: |
| 58 | + title: "Overwritten Titel" |
| 59 | + editable: false |
| 60 | + visible: false |
| 61 | +``` |
| 62 | + |
| 63 | +In this example we will keep all layout and field definitions but overwrite the title, lock and hide the field. |
| 64 | + |
| 65 | +### Show Mode |
| 66 | + |
| 67 | +A custom layout with this setting will hide all fields which are not defined in the configuration. |
| 68 | +Additionally, the provided settings will overwrite the default settings regarding being editable or visible. |
| 69 | + |
| 70 | +``` |
| 71 | +Pimcore\Model\DataObject\TestObject: |
| 72 | + # layouts |
| 73 | + custom_layout: |
| 74 | + label: "My custom layout" |
| 75 | + mode: !php/const Basilicom\AdvancedCustomLayoutBundle\Model\CustomLayoutConfig::MODE_SHOW |
| 76 | + fields: |
| 77 | + title: |
| 78 | + title: "Overwritten Titel" |
| 79 | + editable: false |
| 80 | +``` |
| 81 | + |
| 82 | +In this example we will only show the title attribute which is not editable anymore. |
| 83 | + |
| 84 | +## Utilization |
| 85 | + |
| 86 | +### Updating Custom Layouts |
| 87 | + |
| 88 | +To update the custom layouts you have to run the following command: |
| 89 | + |
| 90 | +``` |
| 91 | +bin/console basilicom:custom-layouts:load |
| 92 | +``` |
| 93 | + |
| 94 | +### For documentation purposes |
| 95 | + |
| 96 | +In some cases you might want to generate an overview of all fields settings per layout. |
| 97 | +In order to do so, you can run the following command: |
| 98 | + |
| 99 | +``` |
| 100 | +bin/console basilicom:custom-layouts:create-excel |
| 101 | +``` |
| 102 | + |
| 103 | +The file will be created in `project/var/bundles/AdvancedCustomLayouts/CustomLayouts.xlsx`. |
| 104 | + |
| 105 | +## TODOs |
| 106 | + |
| 107 | +- FieldCollections, ObjectBricks are not supported yet |
| 108 | + |
| 109 | +# Author |
| 110 | +Alexander Heidrich |
0 commit comments