url
stringlengths
50
196
text
stringlengths
3
17.2k
heading
stringlengths
2
103
embeddings
list
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Dynamic_Select_Types#objectbricks
Objectbricks Name Description containerType "objectbrick" containerKey the type of the object brick outerFieldname the object's object brick attribute object the "object" fieldName the name of the attribute inside the object brick
Objectbricks
[ 0.029105324298143387, -0.6016876101493835, -0.09852258116006851, 0.38598084449768066, 0.02092040330171585, 0.17342500388622284, 0.29680299758911133, 0.006813971791416407, 0.30129560828208923, 0.3172744810581207, -0.19759227335453033, 0.3375420570373535, 0.018821028992533684, 0.096252463757...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Dynamic_Select_Types#fieldcollections
Fieldcollections Name Description containerType "fieldcollection" containerKey the type of the fieldcollection subContainerType sub container type (e.g. localized field inside a field collection) outerFieldname the object's field collection attribute object the "object" fieldName the name of the attribute inside the fieldcollection
Fieldcollections
[ -0.03719187527894974, -0.3514941930770874, -0.15644583106040955, 0.23606327176094055, -0.04586651921272278, 0.15110668540000916, -0.01497405394911766, 0.1288847029209137, 0.0069416663609445095, 0.24549192190170288, -0.2132055014371872, 0.2586243152618408, 0.23403336107730865, -0.0011470008...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Dynamic_Select_Types#classification-store
Classification Store Name Description ownerType "classificationstore" ownerName the name of the classificationstore attribute fieldname the name of the attribute inside the fieldcollection groupId group id keyId key id keyDefinition the fielddefinition of the classificationstore attribute
Classification Store
[ -0.024305537343025208, 0.25353777408599854, -0.12078826129436493, 0.21210268139839172, 0.024977585300803185, 0.06883107125759125, 0.2117113471031189, 0.06286948919296265, -0.059754014015197754, 0.038028255105018616, -0.1592291295528412, 0.24709250032901764, 0.2173897922039032, 0.1645963340...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Fieldcollections#fieldcollection
Fieldcollection
Fieldcollection
[ -0.2763040363788605, 0.19798403978347778, -0.26097938418388367, 0.2109161764383316, -0.048818472772836685, -0.25474971532821655, 0.2442648559808731, 0.05459492281079292, -0.07941195368766785, 0.3613073229789734, 0.19551178812980652, 0.3287166357040405, -0.13782143592834473, -0.104995101690...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Fieldcollections#general-usage
General Usage Object field collections are predefined sets of data and layout fields, that can be added to objects at an arbitrary amount. An object field collection is very similar to an object itself. It has a class or in this case field definition which needs to be made first, and then different field collection definitions can be used to add sets of fields to an object. So with some restrictions you could say, a field collection is an object within an object. When adding a field collection field to an object's class definition, the developer needs to specify the allowed field definition types for this field. The user can then decide which and how many of the available field definitions shall be added to the object.
General Usage
[ 0.15119506418704987, -0.09175198525190353, -0.1091916412115097, 0.028605632483959198, -0.13552168011665344, -0.08317699283361435, -0.06977510452270508, 0.04750759154558182, -0.10945969074964523, 0.05816022679209709, 0.15453104674816132, 0.11074361205101013, 0.16638880968093872, -0.19200426...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Fieldcollections#data-storage
Data Storage Field definition data is stored in a separate table for each field definition and object class. The naming convention for these tables is: object_collection_COLLECTION-NAME_OBJECT-ID. Such a table contains all the field data, the concrete object's id, field name and index of of the field collection within the field collection data field. In order to fully understand the data structure of objects and field collections, it is best to enter some example data and have a look at the tables created by Pimcore.
Data Storage
[ 0.058271609246730804, 0.16680052876472473, -0.18183502554893494, 0.5927056670188904, -0.03863883018493652, -0.05599626153707504, -0.047704633325338364, 0.014895865693688393, -0.32706183195114136, 0.1660381704568863, -0.19929933547973633, 0.22504113614559174, 0.42243486642837524, -0.0253491...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Fieldcollections#working-with-php-api
Working with PHP API Of course, field collection data can be set programmatically as well. The following code snippet illustrates how this can be achieved. Let's say there is an object class collectiontest and a fieldcollection called *MyCollection. There is an object field called collectionitems which is of the type field collection. $object = new DataObject\Collectiontest(); $object->setParentId(1); $object->setUserOwner(1); $object->setUserModification(1); $object->setCreationDate(time()); $object->setKey(uniqid() . rand(10, 99)); $items = new DataObject\Fieldcollection(); for ($i = 0; $i < 5; $i++) { $item = new DataObject\Fieldcollection\Data\MyCollection(); $item->setMyinput("This is a test " . $i); $items->add($item); } $object->setCollectionitems($items); $object->save(); If you want to use localized fields inside field collections you have to set the object before calling any localized field - related methods. $item = new DataObject\Fieldcollection\Data\MyCollection(); $item->setObject($object);
Working with PHP API
[ -0.26092466711997986, 0.36829274892807007, -0.1882283240556717, 0.08119618147611618, -0.019640857353806496, -0.247720405459404, 0.21053113043308258, 0.11632474511861801, -0.17036645114421844, 0.29394999146461487, 0.17778922617435455, 0.2614284157752991, 0.1359463781118393, -0.1513145118951...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Fieldcollections#inheritance
Inheritance Field collections do not support inheritance out of the box because currently field collection data does not get saved to a query table (so you would not be able to query for inherited data). Nevertheless, you can use inheritance for field collections for data maintenance by overriding the class which contains the field collection field and adding a custom getter method to this overriding class: // custom getter for field collection field named 'fieldCollection' public function getFieldCollection(): mixed { $data = parent::getFieldCollection(); $inheritedData = DataObject\Service::useInheritedValues(true, function() use ($data) { if (\Pimcore\Model\DataObject::doGetInheritedValues($this) && $this->getClass()->getFieldDefinition("fieldCollection")->isEmpty($data)) { try { return $this->getValueFromParent("fieldCollection"); } catch (\Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException $e) { // no data from parent available, continue ... return null; } } return null; }); return $inheritedData ?? $data; } Beware that only complete field collection containers can be inherited. As soon as you change the order of the field collection items or any field value in a child object, the whole field collection will get assigned to that child object. There could also be some UI quirks in the Pimcore backend.
Inheritance
[ -0.35202324390411377, 0.19046132266521454, -0.14287404716014862, 0.30735090374946594, 0.2509811818599701, -0.07376795262098312, 0.047773756086826324, 0.07064452022314072, -0.34919315576553345, 0.22197261452674866, -0.18738238513469696, 0.40946003794670105, 0.0632413923740387, -0.2737812995...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Geographic_Types#geographic-datatypes
Geographic Datatypes There are different geographic data types available in pimcore: Geopoint, Geobounds, Geopolygon and Geopolyline. The country select box also belongs to the context of geo widgets, but it is rather a select input widget and therefore it is listed with the other select widgets.
Geographic Datatypes
[ -0.0996081531047821, -0.16618448495864868, -0.10006537288427353, 0.2808133065700531, 0.19376994669437408, -0.1905551254749298, 0.29809921979904175, -0.03182430937886238, 0.13929295539855957, 0.19236871600151062, -0.36397266387939453, 0.3513990044593811, 0.43968114256858826, 0.3514254987239...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Geographic_Types#geopoint
Geopoint The geopoint consists of two coordinates: latitude and longitude. In the Pimcore GUI there is the same geopoint selector widget as shown above. It allows to find coordinates for a geographic point easily. In the database the values are stored in two columns which are called latitude and longitude. Programmatically the data for this field is represented by Pimcore\Model\DataObject\Data\Geopoint. To set a geopoint programmatically, a new Pimcore\Model\DataObject\Data\GeoCoordinates has to be instantiated: $longitude = 107.6191228; $latitude = -6.9174639; $point = new \Pimcore\Model\DataObject\Data\GeoCoordinates($latitude, $longitude); $object->setPoint($point); $object->save();
Geopoint
[ -0.039584506303071976, -0.0884612500667572, -0.11683271825313568, 0.02145630121231079, 0.10294924676418304, -0.17119623720645905, 0.012008024379611015, -0.0663331001996994, -0.27998048067092896, 0.11877857893705368, -0.23546826839447021, 0.42239558696746826, 0.2448473870754242, -0.16220438...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Geographic_Types#geobounds
Geobounds Geobounds represent a geographic area defined by a north eastern point and a south western point. In the pimcore GUI the input widget as shown above is available. In the database there are 4 columns with coordinates to hold the data of geobounds. Programmatically both points are Pimcore\Model\DataObject\Data\GeoCoordinates and they are wrapped by the Pimcore\Model\DataObject\Data\GeoCoordinates Object. The following code snippet shows how to set Geobounds: use Pimcore\Model\DataObject\Data\Geobounds; use Pimcore\Model\DataObject\Data\GeoCoordinates; $northEast = new GeoCoordinates(150.96588134765625, -33.704920213014425); $southWest = new GeoCoordinates(150.60333251953125, -33.893217379440884); $object->setBounds(new Geobounds($northEast,$southWest)); $object->save();
Geobounds
[ -0.11546742916107178, -0.06130184978246689, -0.13170912861824036, 0.04464402049779892, -0.16382049024105072, -0.28005871176719666, -0.025841593742370605, -0.09627767652273178, -0.36794814467430115, 0.02990775927901268, -0.5675879716873169, 0.2606452405452728, 0.316876083612442, 0.060623418...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Geographic_Types#geopolygon
Geopolygon The geopolygon is the third in the row of geo widgets. It allows to define a geographic area by setting an arbitrary amount of geo points. In the database these points are stored in a single column of the data type LONGTEXT in the form of a serialized array of Pimcore\Model\DataObject\Data\GeoCoordinates. To set geopolygon data programmatically, an array of Geopoints has to be passed to the setter: use Pimcore\Model\DataObject\Data\GeoCoordinates; $data = [ new GeoCoordinates(-33.464671118242684, 150.54428100585938), new GeoCoordinates(-33.913733814316245, 150.73654174804688), new GeoCoordinates(-33.9946115848146, 151.2542724609375) ]; $object->setPolygon($data); $object->save();
Geopolygon
[ -0.15567725896835327, -0.1946064680814743, -0.07162085920572281, 0.17309977114200592, 0.08738304674625397, -0.2407638132572174, 0.344887375831604, -0.06721394509077072, -0.04421478509902954, 0.17193250358104706, -0.24770601093769073, 0.24640505015850067, 0.17119137942790985, -0.01331093348...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Geographic_Types#geopolyline
Geopolyline It allows to define a geographic path by setting an arbitrary amount of geo points. In the database these points are stored in a single column of the data type LONGTEXT in the form of a serialized array of Pimcore\Model\DataObject\Data\GeoCoordinates. To set geopolygon data programmatically, an array of Geopoints has to be passed to the setter: use Pimcore\Model\DataObject\Data\GeoCoordinates; $data = [ new GeoCoordinates(-33.464671118242684, 150.54428100585938), new GeoCoordinates(-33.913733814316245, 150.73654174804688), new GeoCoordinates(-33.9946115848146, 151.2542724609375) ]; $object->setPolyline($data); $object->save();
Geopolyline
[ -0.29796648025512695, -0.15144506096839905, -0.07403004169464111, 0.14237505197525024, 0.0977407693862915, -0.43383270502090454, 0.12239217013120651, -0.07430252432823181, -0.17740632593631744, 0.2244645059108734, 0.022404255345463753, 0.4510696828365326, -0.15278001129627228, -0.006704222...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Image_Types#image-datatypes
Image Datatypes
Image Datatypes
[ -0.22925063967704773, -0.2174762785434723, -0.36371538043022156, 0.3544193208217621, 0.32730603218078613, -0.06039993837475777, 0.4297664165496826, 0.0008290069526992738, 0.03512001782655716, -0.030163228511810303, -0.23661668598651886, -0.21539878845214844, -0.18567626178264618, 0.3407610...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Image_Types#image
Image An image field is stored in an INT column in the database. It holds the ID of the referenced \Pimcore\Model\Asset\Image. Unlike other object relation types, an image relation is not stored in the relations table (this has historic reasons), but it creates a dependency in the dependencies table. To set an object's image field programmatically, an \Pimcore\Model\Asset\Image must be passed to the according setter. $image = Asset\Image::getByPath("/examples/example1.jpg"); $object->setImage($image); $object->save(); The image field is represented in the UI by an image drop area. The image drop area's width and height can be configured in the class settings as follows:
Image
[ -0.33125460147857666, 0.19670410454273224, -0.09781716018915176, 0.41657358407974243, 0.13217200338840485, -0.17084729671478271, 0.23166236281394958, 0.06789897382259369, -0.06309454143047333, 0.19630585610866547, 0.03857719898223877, 0.22229918837547302, 0.2309853881597519, 0.065882034599...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Image_Types#working-with-images-in-frontend
Working with images in frontend The get a thumbnail of an image field, just call getThumbnail() on the returned asset object. {% if object.myImage is instanceif('Pimcore\Model\Asset\Image') %} {{ object.myImage.thumbnail('myThumbnailDefinitionName').html }} {% endif %} Since $object->getImage() just returns an asset object, you can of course use all other thumbnail features of Pimcore\Model\Asset\Image.
Working with images in frontend
[ -0.27548494935035706, -0.28122979402542114, -0.18993549048900604, 0.07437126338481903, -0.022970307618379593, -0.1962195485830307, 0.10452544689178467, 0.2545578181743622, -0.07223384082317352, 0.20881284773349762, 0.07393545657396317, 0.22498469054698944, -0.02694842778146267, 0.218535259...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Image_Types#external-image
External Image This one allows you to enter an external image URL which is then shown as a preview. {% if object.getExternalImage() is instanceof('\\Pimcore\\Model\\DataObject\\Data\\ExternalImage') %} <img src="{{ object.getExternalImage().getUrl() }}" /> {% endif %}
External Image
[ -0.2998065948486328, -0.44405820965766907, -0.08967501670122147, -0.10726030170917511, -0.10502829402685165, -0.3626044690608978, 0.1261902153491974, 0.36409804224967957, -0.08827906847000122, 0.17540372908115387, -0.17792947590351105, 0.3654351234436035, -0.030132899060845375, 0.079999715...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Image_Types#image-gallery
Image Gallery Is a collection of Advanced Images (see below). The sort order can be changed via drag & drop. Populate an ImageGallery <?php $galleryData = [ AssetImage, AssetImage, //.... ]; $items = []; foreach($galleryData as $img){ $advancedImage = new \Pimcore\Model\DataObject\Data\Hotspotimage(); $advancedImage->setImage($img); $items[] = $advancedImage; } $news->setGallery(new \Pimcore\Model\DataObject\Data\ImageGallery($items)); ?>
Image Gallery
[ -0.0719795972108841, -0.17169207334518433, -0.2808395326137543, 0.246717631816864, -0.1828830987215042, 0.14737139642238617, 0.039026279002428055, 0.1653732806444168, -0.02148369513452053, 0.3111587166786194, -0.30136823654174805, 0.0668129101395607, 0.032708801329135895, -0.08765888959169...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Image_Types#image-advanced-(supporting-hotspotsmarkerscropping)
Image Advanced (supporting Hotspots/Markers/Cropping) This data type is an advanced extension to the image data type which allows defining hotspots, markers and cropping on the assigned image. The hotspots are defined by a name and are stored as an array with the attributes name, top, left, width and height whereas the values top, left, width, height are stored as percentages of the image dimensions.
Image Advanced (supporting Hotspots/Markers/Cropping)
[ -0.13313576579093933, -0.6453074812889099, -0.15829966962337494, 0.15939396619796753, -0.07253852486610413, -0.030651066452264786, 0.14414054155349731, -0.000508459226693958, 0.3201597332954407, -0.03801640123128891, -0.11160614341497421, 0.034583680331707, -0.2631451189517975, 0.249224022...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Image_Types#get-hotspots
Get Hotspots To access the hotspots programmatically, following code snipped can be used. $hotspotImage = $object->getHotspot1(); // name of the field in Pimcore is "hotspot1" in this case (class definition) //get the assigned Asset\Image $image = $hotspotImage->getImage(); //get an array of all defined hotspots $hotspots = $hotspotImage->getHotspots(); The content of $hotspots could look like: Array ( [0] => Array ( [name] => hotspot1 [top] => 3.8922155688623 [left] => 48.076923076923 [width] => 8.3333333333333 [height] => 48.802395209581 ) [1] => Array ( [name] => hotspot2 [top] => 8.9820359281437 [left] => 70.897435897436 [width] => 14.230769230769 [height] => 44.011976047904 ) ) This information can be used in the frontend to visualize the hotspots.
Get Hotspots
[ -0.6202598214149475, -0.33909496665000916, -0.16713978350162506, 0.5226199626922607, 0.0405854731798172, -0.1833522766828537, 0.30080270767211914, 0.133112370967865, -0.06821969151496887, 0.23992539942264557, -0.28893211483955383, 0.4795154929161072, -0.012372815981507301, 0.11884295940399...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Image_Types#get-markers
Get Markers For markers this is completely the same procedure: $hotspotImage = $object->getHotspot1(); // name of the field in Pimcore is "hotspot1" in this case (class definition) //get an array of all defined marker $marker = $hotspotImage->getMarker(); The content of $marker could look like: Array ( [0] => Array ( [top] => 3.8922155688623 [left] => 48.076923076923 ) [1] => Array ( [top] => 8.9820359281437 [left] => 70.897435897436 ) )
Get Markers
[ -0.23290327191352844, -0.3824186325073242, -0.13401493430137634, 0.4133668839931488, -0.11934968829154968, -0.3089665472507477, 0.30606362223625183, 0.19870726764202118, -0.1633840799331665, 0.25823649764060974, -0.00869828276336193, 0.5459446907043457, -0.12417064607143402, -0.04802512750...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Image_Types#get-the-cropped-image
Get the cropped image To get the cropped image you have to use the getThumbnail() method: $hotspotImage = $object->getHotspot1(); // name of the field in Pimcore is "hotspot1" in this case (class definition) echo $hotspotImage->getThumbnail(); // this example returns the image cropped with the original dimensions echo $hotspotImage->getThumbnail("myCustomThumbnail"); // this example returns the cropped thumbnail according to the configuration (similar to document's $this->image())
Get the cropped image
[ -0.5643052458763123, -0.5165354013442993, -0.09380548447370529, 0.13410773873329163, -0.2657041847705841, -0.35413581132888794, 0.1596924066543579, 0.15440958738327026, -0.24955427646636963, 0.39715641736984253, -0.0318242684006691, 0.3153572082519531, 0.18063633143901825, 0.10121410340070...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Image_Types#thumbnail-of-image
Thumbnail of image Of course you can use the above code regardless if the image is cropped or not: $hotspotImage->getThumbnail("myCustomThumbnail"); // $hotspotImage contains no cropping information, the thumbnail is returned as usual (see $assetImage->getThumbnail("..."); )
Thumbnail of image
[ -0.5900096297264099, -0.5131741762161255, -0.14713993668556213, -0.05309499427676201, -0.3652147650718689, -0.1687389761209488, 0.3046933710575104, 0.17398376762866974, 0.14937198162078857, 0.2954297959804535, 0.13011524081230164, 0.07623675465583801, -0.11916838586330414, -0.0371753647923...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Image_Types#populate-the-advanced-image-type
Populate the advanced image type $image = Asset::getById(123); $advancedImage = new DataObject\Data\Hotspotimage(); $advancedImage->setImage($image); // ... $object->setMyAdvancedImage($advancedImage);
Populate the advanced image type
[ -0.4746939539909363, -0.3145883083343506, -0.16756610572338104, 0.27951234579086304, 0.15340109169483185, -0.024696242064237595, 0.39045193791389465, 0.08784530311822891, 0.03439587354660034, 0.23845581710338593, 0.04634877294301987, -0.041154101490974426, -0.02417166158556938, 0.099668137...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Image_Types#predefined-data-templates
Predefined Data Templates In addition to the empty standard data template you can provide a JSON config in the classdefinition describing additional custom templates. These will show up as split button entries in the "add marker/add hotspot" menu. { "marker": [{ "menuName": "marker config 1", "name": "hotspot name", "data": [{ "name": "my asset href", "type": "asset", "value": "/screenshots/glossary.png" }, { "name": "my textfield", "type": "textfield" }] }], "hotspot": [{ "menuName": "hotspot config 1" }] }
Predefined Data Templates
[ 0.010821131058037281, -0.23185595870018005, -0.13174910843372345, 0.03953644260764122, -0.06552235782146454, -0.04494135454297066, 0.2716774344444275, 0.24256177246570587, 0.27284592390060425, -0.15552546083927155, -0.04933946579694748, 0.43830740451812744, -0.022515665739774704, 0.3867932...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Localized_Fields#localized-fields
Localized Fields Localized fields allow the definition of attributes, that should be translated into multiple languages within an object. They can be filled with selected data types and layouts - due to technical and data storage reasons not all data types are available. The advantage of this, is to make it very easy to translate fields to the configured languages.
Localized Fields
[ 0.06374944001436234, -0.47229909896850586, -0.18962427973747253, 0.009184702299535275, 0.2855909466743469, -0.11580047011375427, 0.24669888615608215, 0.10662461072206497, 0.13842523097991943, 0.2943747341632843, -0.04426388069987297, 0.0448409803211689, 0.24012739956378937, 0.0758263990283...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Localized_Fields#definition-of-localized-fields
Definition of localized fields First of all, you have to configure your localized fields and layouts within your class. This can be easily done in the class editor. Then add attributes, that need to be translated, into this container. Pimcore generated the input widgets for every configured language. The result in your object editor will look like below: By default, tabs are used if the number of languages does not exceed 15. This limit can be changed via the field settings in the class configurator.
Definition of localized fields
[ -0.060843974351882935, -0.3335288166999817, -0.13814875483512878, 0.12963785231113434, 0.3143700957298279, -0.4352307617664337, 0.3751770555973053, 0.01525857299566269, 0.0774565041065216, 0.34378474950790405, -0.13122259080410004, 0.3528786897659302, 0.3681327700614929, 0.2795562446117401...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Localized_Fields#definition-of-available-languages
Definition of available Languages If it's not already configured, please specify the valid languages for your website. You can do this in Settings -> System Settings -> Localization & Internationalization
Definition of available Languages
[ 0.0408419668674469, -0.20580723881721497, -0.3027096688747406, -0.028935670852661133, 0.26360753178596497, 0.06382572650909424, 0.18296955525875092, 0.1991148591041565, 0.15204918384552002, 0.21625611186027527, -0.1774170845746994, -0.14277656376361847, 0.20866091549396515, 0.0195394847542...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Localized_Fields#inheritance
Inheritance Fallback and inherited values are evaluated in a vertical way first. This is contrary to the Classification Store where the evaluation is done in a horizontal way. If no value for the current language is found, the parent level is checked. If walking up the inheritance levels yields no result, the fallback language of the lowermost level will be checked in the same way. (Also walking up the inheritance levels for this language). Consider the following example and let’s assume that English is the fallback language for German. We request the German value for the object at level 3. Since the only value can be found on level 1 for the default language the tree is traversed as depicted.
Inheritance
[ 0.17042799293994904, -0.1781323403120041, -0.04302465543150902, 0.3271443545818329, 0.004501188639551401, -0.26925674080848694, 0.18296553194522858, -0.033997807651758194, -0.11261838674545288, 0.19304299354553223, -0.06655997782945633, 0.24362792074680328, 0.25203052163124084, -0.29951196...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Localized_Fields#working-with-php-api
Working with PHP API
Working with PHP API
[ 0.014921712689101696, -0.2032509297132492, -0.4213288426399231, 0.16371123492717743, -0.04071773216128349, -0.27750033140182495, -0.009737549349665642, 0.2050803005695343, 0.06089754402637482, 0.38214102387428284, 0.35521677136421204, -0.007113938685506582, -0.057098571211099625, 0.0365471...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Localized_Fields#getting-available-languages
Getting available languages The following code will create an array containing the available languages for the front end (the user facing website). $languages = \Pimcore\Tool::getValidLanguages();
Getting available languages
[ -0.2883526682853699, -0.2292649894952774, -0.3540293276309967, 0.2506870925426483, 0.11982839554548264, -0.043498072773218155, 0.03413713723421097, 0.28357353806495667, 0.034676868468523026, 0.3138856887817383, -0.3045981526374817, 0.06585495918989182, 0.057333897799253464, 0.0709718912839...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Localized_Fields#disable-fallback-languages
Disable Fallback languages You can disable the Fallback languages \Pimcore\Model\DataObject\Localizedfield::setGetFallbackValues(false);
Disable Fallback languages
[ -0.4055863320827484, -0.09449554979801178, -0.16340620815753937, 0.062141042202711105, 0.44816699624061584, -0.34291425347328186, 0.15194687247276306, 0.24571353197097778, -0.1832716315984726, 0.43879950046539307, -0.10783323645591736, 0.3205850124359131, 0.1703679859638214, 0.091340675950...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Localized_Fields#accessing-the-data
Accessing the data Accessing the data is simple as below: // with global registered locale $object = DataObject::getById(234); $object->getInput1(); // will return the en_US data for the field "input1" // get specific localized data, regardless which locale is globally registered $object->getInput1("de"); // will return the German value for the field "input1"
Accessing the data
[ -0.022823190316557884, -0.12479241192340851, -0.2455325573682785, 0.547614336013794, 0.04986117407679558, -0.2633001208305359, 0.18450647592544556, 0.1734471619129181, -0.015941204503178596, 0.3745327591896057, 0.07891829311847687, 0.036430396139621735, 0.08405466377735138, 0.1018201038241...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Localized_Fields#setting-data
Setting data It works in the similar way as getting the data. $object = DataObject::getById(234); $object->setInput1("My Name", "fr"); // set the French value for the field "input1" Warning: Please note that moving a field from outside (normal object field) into the localizedfield container means the loss of data from the field in all objects using this class.
Setting data
[ 0.11463584005832672, -0.009644238278269768, -0.0916442722082138, 0.30845463275909424, 0.14143836498260498, -0.28686389327049255, 0.13535207509994507, 0.06047118455171585, -0.14339742064476013, 0.4938373267650604, 0.3164324164390564, 0.061002619564533234, 0.29306626319885254, 0.144427254796...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Number_Types#number-datatypes
Number Datatypes Both numeric data types (number and slider) are stored as a number in a DOUBLE column in the database. To set numeric data, a number must be passed to the according setter. The two fields merely differ in their GUI input widgets and the fact that the slider has a min/max value and step size, which the numeric field does not have.
Number Datatypes
[ -0.004602463915944099, -0.2816299796104431, -0.08875984698534012, 0.4284316897392273, 0.2749599516391754, -0.20939454436302185, 0.29865843057632446, -0.1307293027639389, -0.1570250242948532, 0.23384727537631989, 0.022219983860850334, 0.12540005147457123, 0.16139160096645355, 0.184726715087...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Number_Types#numeric
Numeric The numeric data field can be configured with a default value. In the GUI it is represented by a spinner field.
Numeric
[ -0.2624354064464569, -0.4778733551502228, -0.15055052936077118, -0.02365589700639248, 0.23091286420822144, -0.34327858686447144, 0.3563117980957031, -0.01830318011343479, -0.01782500557601452, 0.4420114755630493, 0.09342652559280396, 0.1708514541387558, 0.03741704672574997, 0.2834316492080...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Number_Types#numeric-range
Numeric Range The numericRange object field consists of two numeric fields (minimum and maximum) and so can be configured the same way. Programmatically the values are represented by a NumericRange Object.
Numeric Range
[ -0.16586455702781677, -0.6003940105438232, -0.22476805746555328, -0.10024739801883698, 0.15957365930080414, -0.31253454089164734, 0.2562910318374634, -0.06668485701084137, -0.09746000170707703, 0.3425608277320862, -0.3375093936920166, 0.16079433262348175, 0.11729518324136734, 0.22555619478...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Number_Types#slider
Slider In the GUI a slider can be used as a horizontal or vertical widget. It needs to be configured with a min and max value, the increment step and decimal precision.
Slider
[ -0.2298610359430313, -0.4915893077850342, -0.1280495673418045, -0.22226788103580475, -0.07215308398008347, -0.16738229990005493, 0.2471771538257599, 0.06933535635471344, 0.005333344452083111, 0.3947015106678009, -0.05158030986785889, 0.20723263919353485, -0.058023303747177124, 0.3723709881...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Number_Types#quantity-value
Quantity Value This is a numeric datatype that also allows to specify a unit. Start off with defining a global list of known units. This can also be achieved programmatically. $unit = new Pimcore\Model\DataObject\QuantityValue\Unit(); $unit->setAbbreviation("km"); // mandatory $unit->setLongname("kilometers"); $unit->setGroup("dimension"); $unit->save(); In the class editor, it is possible to restrict the list of valid units on a field-level. Only those units will be available then. The following code snippet shows how to set a value. use Pimcore\Model\DataObject; $parent = DataObject::getByPath("/"); $object = new DataObject\Test(); $unit = DataObject\QuantityValue\Unit::getByAbbreviation("km"); $object->setKey("test2"); $object->setParent($parent); $object->setHeight(new DataObject\Data\QuantityValue(27, $unit->getId())); $object->save();
Quantity Value
[ -0.31733086705207825, -0.07431042939424515, -0.13340900838375092, 0.22133325040340424, 0.31669625639915466, -0.4310266077518463, 0.28196030855178833, 0.028019053861498833, -0.3555174469947815, 0.5420360565185547, -0.04501527547836304, 0.11569038778543472, 0.10921262949705124, 0.22518965601...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Number_Types#quantity-value-range
Quantity Value Range The quantityValueRange object field is basically the same as the quantityValue field, except that is has two input fields (minimum and maximum). Programmatically the values are represented by a QuantityValueRange Object.
Quantity Value Range
[ -0.18025577068328857, -0.19129031896591187, -0.23502354323863983, 0.118248850107193, -0.027719222009181976, -0.3714175522327423, 0.08780501782894135, -0.20821326971054077, -0.38208553194999695, 0.33417412638664246, -0.36005899310112, 0.2688368558883667, 0.07196996361017227, 0.3923803865909...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Number_Types#quantity-value-unit-conversion
Quantity Value Unit Conversion
Quantity Value Unit Conversion
[ -0.16530448198318481, -0.3767767548561096, -0.31639111042022705, 0.18451373279094696, 0.2717585861682892, -0.37416139245033264, 0.36694368720054626, -0.05120697245001793, -0.4333950877189636, 0.2845805585384369, -0.11782439798116684, 0.12309923768043518, 0.16342075169086456, 0.428803682327...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Number_Types#static-unit-conversion
Static unit conversion You can also convert values between units. Therefore you have to define base units, conversion factors and offsets. All units with the same base unit can be converted to each other. Example: You have physical length units meter (m), millimeters (mm) and inches ("). Then your quantity value unit configuration could look like: Name Abbreviation Baseunit Factor Meter m Millimeter mm m 0.001 Inch " m 0.0254 When you now have a quantity value field in your data objects and change the unit to a unit which has the same base unit as the unit before the value gets automatically converted. For example when you have 2 m and change the unit to "mm" then the value will automatically change to 2000. You can also trigger conversion programmatically: $originalValue = new QuantityValue(3, Unit::getByAbbreviation('m')->getId()); $converter = $this->container->get(\Pimcore\Model\DataObject\QuantityValue\UnitConversionService::class); $convertedValue = $converter->convert($originalValue, Unit::getByAbbreviation('mm')); // $convertedValue is a QuantityValue with value 3000 and unit mm Alternatively you can use $originalValue = new QuantityValue(3, Unit::getByAbbreviation('m')->getId()); $convertedValue = $originalValue->convertTo(Unit::getByAbbreviation('mm')); // $convertedValue is a QuantityValue with value 3000 and unit mm or $originalValue = new QuantityValue(3, Unit::getByAbbreviation('m')->getId()); $convertedValue = $originalValue->convertTo('mm'); // $convertedValue is a QuantityValue with value 3000 and unit mm Units without base unit are expected to be a base unit itself. That is why in above example configuration meter has no base unit - but of course you can set it to meter to be more explicit. In quantity value unit configuration there is also the column "offset". This is for unit conversions where addition / subtraction is needed. For example Name Abbreviation Baseunit Factor Offset Degrees Celcius °C Degrees Fahrenheit °F °C 1.8 32 These conversion parameters result from the formula °F = °C * 1.8 + 32
Static unit conversion
[ -0.552676260471344, -0.2802061438560486, -0.09004980325698853, 0.19731101393699646, 0.37588930130004883, -0.4023001790046692, 0.3753799796104431, -0.09988950937986374, -0.38145720958709717, 0.5397416949272156, 0.010999923571944237, 0.16327352821826935, 0.2497984766960144, 0.228005707263946...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Number_Types#dynamic-unit-conversion
Dynamic unit conversion When conversion factors / offsets change over time (e.g. money currencies) or you want to use an external API you have two opportunities: You could periodically update the factors / offsets in quantity value unit configuration You can create a converter service class If you prefer the latter you have to create a class which implements \Pimcore\Model\DataObject\QuantityValue\QuantityValueConverterInterface and define a service for this class in your services.yaml. The service name can then be entered in quantity value unit configuration's column "Converter service" for the base unit.
Dynamic unit conversion
[ -0.45583030581474304, -0.1959771066904068, -0.09444395452737808, -0.0786416158080101, 0.37302541732788086, -0.32745254039764404, 0.2992238998413086, -0.06765096634626389, -0.4138616919517517, 0.39621761441230774, -0.13740599155426025, 0.2718488276004791, 0.3394700288772583, 0.5273168683052...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Number_Types#input-quantity-value
Input Quantity Value Input Quantity Value is quite similar to Quantity Value except that text values are allowed instead of the strict restriction to numeric values.
Input Quantity Value
[ -0.011780855245888233, -0.516518235206604, -0.31604844331741333, -0.18771763145923615, 0.0800650492310524, -0.3719426691532135, 0.2634856104850769, -0.08991790562868118, -0.28898265957832336, 0.4382277727127075, -0.09037336707115173, 0.11988066136837006, 0.03708385303616524, 0.494830548763...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Object_Bricks#objects-bricks
Objects Bricks
Objects Bricks
[ 0.04776608198881149, -0.270491361618042, -0.28629860281944275, 0.2888731062412262, 0.06313338875770569, -0.13356587290763855, 0.47717657685279846, 0.08551854640245438, 0.32873693108558655, 0.2388538122177124, -0.10094316303730011, 0.28647467494010925, -0.22609081864356995, -0.2109246104955...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Object_Bricks#general
General With Objectbricks, objects can be extended without changing the class definition. This is especially useful when storing product data. Often there is a base set of attributes, which all products have. But then there are lots of attributes, which only a subset of your products have. Take the example of a car accessories dealer. Brakes have different attributes than tires, rims or navigation systems. The old-fashioned way to deal with this use case is, to define a product class which contains all possible attributes from all product types. This would work fine, but most of the attributes will be empty and the object editor would be quite unmanageable. The new way is to use Objectbricks. The product class itself has only attributes all products have. This might be attributes like name, article number, manufacturer, price, etc. In addition to that, for each product group there is an object brick. The object brick for brakes has attributes like diameter, material. The object brick for tires has dimension, type, maximum speed and so on. By creating a tire product object, the tire object brick is added and so this tire product has all the tire attributes. To one object a number of Objectbricks can be added, but just one instance per object brick type. This is the main difference to Fieldcollections. Because only one instance per object brick can be added to an object, Objectbricks fully support inheritance on field level. Each attribute of an object brick can be overwritten in child objects. Despite this flexibility, the database model in the background stays clean and well structured. This is because the attributes of an object brick have to be defined like these of Fieldcollections.
General
[ -0.07750678062438965, -0.0015664940001443028, -0.20437607169151306, 0.33627089858055115, 0.08231526613235474, -0.0868694856762886, 0.41490456461906433, -0.1286422461271286, 0.14302821457386017, 0.3043909966945648, -0.030391456559300423, 0.3165118098258972, -0.36015865206718445, -0.03604139...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Object_Bricks#definition-of-an-objectbrick
Definition of an Objectbrick As mentioned before, Objectbricks themselves are defined the same way as objects and Fieldcollections are and support similar data types as Fieldcollections. To allow adding an Objectbrick to an object, two things have to be done: In data components list (when you're creating the class) is Objectbricks data type. This data type defines, where Objectbricks can be added. A field of this data type has to be added to the object class. In the Objectbrick definition, the object class and the desired field has to be added to the allowed classes. In the object bricks definition, you can also specify a parent class - a way is the same like for classes (you can find more details in the Parent Class for Objects section).
Definition of an Objectbrick
[ 0.027666890993714333, -0.008728238753974438, -0.06190674379467964, 0.3619095981121063, 0.2793230712413788, -0.02666572667658329, 0.3042864501476288, -0.2345740795135498, 0.29469794034957886, 0.23476243019104004, -0.08957350999116898, 0.2381441444158554, -0.14999398589134216, -0.06309664249...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Object_Bricks#working-with-php-api
Working with PHP API
Working with PHP API
[ 0.014921712689101696, -0.2032509297132492, -0.4213288426399231, 0.16371123492717743, -0.04071773216128349, -0.27750033140182495, -0.009737549349665642, 0.2050803005695343, 0.06089754402637482, 0.38214102387428284, 0.35521677136421204, -0.007113938685506582, -0.057098571211099625, 0.0365471...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Object_Bricks#retrieving-objectbricks
Retrieving Objectbricks By saving the object class, for each Objectbrick field of this class, the own data class is created with getters for each allowed Objectbrick. In our example, this data class would looks like this. The getter $product->getBricks() returns an instance of this class filled with the Objectbricks of the $product. By calling the getter, the Objectbrick class with its attribute getter is returned. //receiving data of a Objectbrick $product = DataObject\Product::getById(4); $tiretype = $product->getBricks()->getTire()->getTiretype(); Setting data works the same way as retrieving data. For all getters there are corresponding setters. By saving an object, all bricks are saved too. //setting data of a Objectbrick $product = DataObject\Product::getById(4); $product->getBricks()->getTire()->setTiretype("Winter"); $product->save(); //adding a new Objectbrick to an object $product = new DataObject\Product(); $product->setKey("testproduct"); $product->setParent(DataObject\Product::getById(4)); $product->setName("testproduct"); $tireBrick = new DataObject\Objectbrick\Data\Tire($product); $tireBrick->setTiretype("allyear"); $product->getBricks()->setTire($tireBrick); $product->save();
Retrieving Objectbricks
[ -0.05337695777416229, -0.007216297555714846, -0.1376294195652008, 0.7713506817817688, 0.03493610396981239, -0.3031308948993683, 0.25941702723503113, 0.05870199576020241, -0.16956882178783417, 0.33650705218315125, -0.06302181631326675, 0.24090540409088135, -0.25067445635795593, 0.1309433281...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Object_Bricks#deleting-objectbricks-via-code
Deleting ObjectBricks via code //remove all ObjectBricks from an ObjectBrick field $product->getBricks()->delete($product); $product->save(); $productBricks = $product->getBricks(); $tireBrick = $productBricks->getTire(); if ($tireBrick) { $tireBrick->setDoDelete(true); } $product->save();
Deleting ObjectBricks via code
[ 0.12122979015111923, -0.29112687706947327, -0.16622352600097656, 0.4144520163536072, -0.036099307239055634, 0.06706912070512772, 0.3628821074962616, 0.10978897660970688, -0.17647428810596466, 0.3314070701599121, -0.16934241354465485, 0.3846933841705322, -0.48397624492645264, 0.038994826376...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Object_Bricks#querying-for-objectbrick-data
Querying for Objectbrick data Data of Objectbricks can be queried in the same way as data of fieldcollections. The Objectbricks have to be added to the DataObject\Listing object and then the Objectbrick data can be queried in the condition like in the sample below. //querying for Objectbrick data $productList = DataObject\Product::getList([ /* add here all Objectbricks you need in the condition */ "objectbricks" => ["Tire","Brake"], /* in the condition access Objectbrick attributes with OBJECTBRICKNAME.ATTRIBUTENAME */ "condition" => "Tire.dimension > 200" ]); If you want to obtain a list of objects which have a specific Objectbrick you can query for the fieldname value in the condition statement. //return all Products that have the Objectbrick "Tire" $productList = DataObject\Product::getList([ /* add here all Objectbricks you need in the condition */ "objectbricks" => ["Tire"], /* in the condition access Objectbrick attributes with OBJECTBRICKNAME.ATTRIBUTENAME */ "condition" => "Tire.fieldname != ''" ]);
Querying for Objectbrick data
[ -0.14585372805595398, -0.06227945536375046, -0.22298932075500488, 0.8253585696220398, 0.0386226549744606, -0.14607612788677216, -0.03923483192920685, 0.42115816473960876, 0.15276025235652924, 0.2860395908355713, -0.10068175196647644, 0.30086958408355713, -0.2984839379787445, 0.005991765297...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Others#other-datatypes
Other Datatypes
Other Datatypes
[ -0.21835899353027344, -0.22012677788734436, -0.3123936355113983, 0.3063375949859619, 0.3321075737476349, -0.01508074440062046, 0.19981372356414795, 0.06829983741044998, 0.006809713784605265, -0.02182612754404545, -0.30592137575149536, -0.03716794028878212, -0.09933528304100037, 0.459995478...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Others#checkbox
Checkbox A checkbox field can be configured to be checked by default when a new object is created. It is stored in a TINYINT column in the database with the value 0 or 1. In order to set a checkbox value, a bool value needs to be passed to the according setter of the object: $object->setCheckbox(true); If inheritance is activated in the corresponding DataObject class, a trashcan icon is displayed next to the checkbox. This can be used to reset the value of the checkbox in order to guarantee inheritance from parents again.
Checkbox
[ -0.25896918773651123, -0.0336470752954483, -0.12638907134532928, 0.22758808732032776, -0.012542994692921638, -0.24276375770568848, 0.051138292998075485, 0.15064629912376404, 0.18414968252182007, 0.36417636275291443, 0.06073317304253578, 0.20287877321243286, -0.28824934363365173, 0.18536666...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Others#boolean-select
Boolean Select A Boolean Select is kind of a tri-state checkbox which is rendered as a select datatype in the admin UI. The background is that a checkbox can only have two states. This is especially important when it comes to inheritance. A checkbox treats an empty (never set) value just like the unchecked value. The consequence is then as soon as a parent sets it checked you can not reset it to unchecked in the child nodes anymore. The boolean select takes care of this problem by introducing a third state. The storage values are -1 (for unchecked), 1 (for checked and null for empty. For the admin UI you can specify the display values according to your needs. Default values are yes, no and empty.
Boolean Select
[ 0.0848459005355835, -0.4104377031326294, -0.20850202441215515, -0.14730626344680786, -0.15987634658813477, -0.2777179181575775, 0.046310365200042725, 0.20397618412971497, 0.44268178939819336, 0.2534332573413849, -0.17686061561107635, 0.440778911113739, -0.09633176028728485, 0.3898150920867...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Others#link
Link In the UI a link is displayed as text. Its details can be edited by clicking on the button next to the link text. In the object class definition there are no special configurations available for an object field link. The link object field has its own data class which is Pimcore\Model\DataObject\Data\Link. In order to set a link programmatically an Pimcore\Model\DataObject\Data\Link object needs to be instantiated and passed to the setter: $l = new DataObject\Data\Link(); $l->setPath("http://www.pimcore.org"); $l->setText("pimcore.org"); $l->setTitle("Visit pimcore.org"); $object->setLink($l); In the database the link is stored in a TEXT column which holds the serialized data of an Pimcore\Model\DataObject\Data\Link. In the frontend (template) you can use the following code to the the html for the link. <?php $object = DataObject::getById(234); ?> <ul> <li><?= $object->getMyLink()->getHtml(); ?></li> </ul>
Link
[ -0.12128787487745285, -0.07003315538167953, -0.026036303490400314, 0.08194530755281448, 0.21497945487499237, -0.3422996401786804, 0.025816837325692177, -0.13045479357242584, -0.23978246748447418, 0.04384397715330124, -0.08312474191188812, 0.4986342191696167, 0.23548460006713867, 0.15341633...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Others#link-generators
Link Generators Please also see the section about Link Generators
Link Generators
[ -0.06871291995048523, -0.3306467831134796, -0.3301086723804474, -0.02631792053580284, 0.10216500610113144, -0.29370519518852234, 0.2667296528816223, -0.06496075540781021, 0.09238899499177933, 0.2386464923620224, -0.07374066114425659, 0.08644226938486099, -0.09858942776918411, 0.02726933173...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Others#rgba-color
RGBA Color Allows to store RGBA Values. RGB and Alpha values are stored as hex values in two separate columns as hex values in the database. API Examples: $o = \Pimcore\Model\DataObject\User::getById(50); // get the color, can be null! $color = $o->getMyColor(); // get the RGB part as hex with leading # var_dump($color->getHex()); // get the RGBA value (with alpha component) has without leading hash var_dump($color->getHex(true, false)); // get the RGBA value as array (R,G,B 0-255, Alpha 0-1) var_dump($color->getCssRgba(true, true)); // set the RGBA value $color->setRgba(0, 0, 255, 64);
RGBA Color
[ -0.4766633212566376, -0.03962671011686325, -0.08478730916976929, 0.2616705596446991, 0.020755935460329056, -0.2321723997592926, 0.1444682478904724, 0.15437810122966766, -0.4269077181816101, 0.35975977778434753, -0.286159485578537, 0.024645911529660225, 0.027401506900787354, 0.2119285911321...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Others#encrypted-field
Encrypted Field Offers data encryption for certain data types. Prerequisites: generate a secret key by calling vendor/bin/generate-defuse-key and add it to config/config.yaml Example: pimcore: encryption: secret: def00000fc1e34a17a03e2ef85329325b0736a5941633f8062f6b0a1a20f416751af119256bea0abf83ac33ef656b3fff087e1ce71fa6b8810d7f854fe2781f3fe4507f6 Key generation:
Encrypted Field
[ -0.24452269077301025, -0.20420150458812714, -0.20044827461242676, 0.1298886239528656, 0.15391245484352112, -0.39612630009651184, 0.21220806241035461, -0.00618566432967782, -0.16990825533866882, 0.31750982999801636, 0.06852801889181137, 0.5197926759719849, 0.14686954021453857, 0.44299966096...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Others#strict-mode
Strict Mode In strict mode (which is the default) an exception is thrown if existing data cannot be decrypted (e.g. because of a key change). You can switch this off by calling Pimcore\Model\DataObject\ClassDefinition\Data\EncryptedField::setStrictMode(false)
Strict Mode
[ -0.26116943359375, -0.2054625302553177, -0.0676715299487114, 0.11597231775522232, 0.12354975193738937, -0.3046525716781616, 0.15658167004585266, 0.06573618948459625, -0.22847504913806915, 0.481484055519104, 0.043099574744701385, 0.48745784163475037, 0.16725651919841766, -0.0322980545461177...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Others#url-slug
URL Slug A slug is the part of a URL which identifies a particular page on a website in an easy to read form. In other words, it’s the part of the URL that explains the page’s content. For example, if the URL is https://demo.pimcore.fun/slug, then the slug simply is /slug. Note that currently URL slugs are not supported inside Blocks & Classification Stores. This data-type can be used to manage custom URL slugs for data objects, you can add as many fields of this type to a class as you want. Pimcore then cares automatically about the routing and calls the configured controller/action if a slug matches. You could use the Symfony String component's slugger to generate the slugs. Note that slugs can't contain the following chars: ? # since they are reserved characters. For more information check the RFC 3986.
URL Slug
[ 0.2943574786186218, -0.27185362577438354, 0.002008723095059395, 0.0755208358168602, 0.05910023674368858, -0.2360205501317978, 0.18742042779922485, -0.08054351061582565, -0.3837694525718689, 0.11691909283399582, -0.0357077457010746, 0.11332007497549057, -0.08146557956933975, 0.1418838351964...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Others#example
Example <?php namespace App\Controller; use Pimcore\Controller\FrontendController; use Pimcore\Model\DataObject; use Symfony\Component\HttpFoundation\Request; class ProductController extends FrontendController { public function slugAction(Request $request, DataObject\Foo $object, DataObject\Data\UrlSlug $urlSlug): array { // we use param resolver to the the matched data object ($object) // $urlSlug contains the context information of the slug return [ 'product' => $object ]; } }
Example
[ 0.02271910570561886, -0.1907157301902771, -0.1292571872472763, 0.11261243373155594, 0.08260589838027954, -0.45560222864151, 0.120606429874897, 0.11870845407247543, -0.488794207572937, 0.1295824646949768, -0.17519547045230865, 0.17807252705097198, 0.05511439964175224, 0.06876109540462494, ...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#relational-datatypes
Relational Datatypes
Relational Datatypes
[ -0.07149811089038849, 0.06362497806549072, -0.35681331157684326, 0.39781734347343445, 0.12787604331970215, -0.15091505646705627, 0.20530308783054352, 0.025233065709471703, 0.06145167350769043, -0.23021270334720612, -0.329041063785553, -0.27940699458122253, 0.10210182517766953, 0.3918866813...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#many-to-one,-many-to-many-and-many-to-many-object-relation-data-fields
Many-To-One, Many-To-Many and Many-To-Many Object Relation Data Fields Many-To-One, Many-To-Many and Many-To-Many Objects are pure relation data types, which means they represent a relation to an other Pimcore element (document, asset, object). The Many-To-One and Many-To-Many data types can store relations to any other Pimcore element. In the object field definition there is the possibility to configure which types and subtypes of elements are allowed. The Many-To-Many Object field allows relations to one or more data objects, but no other elements. Therefore the restriction settings for objects are limited to object classes. The width and height of the input widget can be configured in the object class settings. For a Many-To-One relation only the width can be configured, since it is represented by a single drop area. Lazy Loading is explained further below in the section about relations and lazy loading. The input widgets for all three relation data types are represented by drop areas, which allow to drag and drop elements from the tree on the left to the drop target in the object layout. In addition to the drag and drop feature, elements can be searched and selected directly from the input widget. In case of objects it is even possible to create a new object and select it for the objects widget.
Many-To-One, Many-To-Many and Many-To-Many Object Relation Data Fields
[ -0.060931283980607986, -0.5671967267990112, -0.04868409410119057, 0.31972736120224, 0.1612417995929718, -0.2184096723794937, 0.3174850046634674, -0.05420898646116257, 0.1535741537809372, 0.04233968257904053, -0.4098733961582184, 0.06600003689527512, 0.3786509037017822, 0.20471078157424927,...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#filtering-for-relations-via-php-api
Filtering for relations via PHP API These pure relation types are stored in a separate database table called object_relations_ID. In the according object_~ID~ database view, which is used for querying data, the relations fields are summarized as a comma separated list of IDs of related elements. Therefore, if one needs to create an object list with a filter condition on a relation column this can be achieved as follows: $relationId = 162; $list = new \Pimcore\Model\DataObject\Example\Listing(); $list->setCondition("mySingleRelation__id = ".$relationId); $objects=$list->load(); $relationId = 345; $list = new \Pimcore\Model\DataObject\Example\Listing(); $list->setCondition("myManyToManyRelations like '%,object|".$relationId.",%'"); $objects=$list->load();
Filtering for relations via PHP API
[ -0.12392936646938324, 0.039216507226228714, -0.21985073387622833, 0.2176096886396408, -0.15638791024684906, -0.33311089873313904, -0.006398445460945368, 0.37628382444381714, 0.28745728731155396, -0.25105929374694824, -0.45926180481910706, -0.02942652627825737, 0.13569021224975586, 0.000195...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#assigning-relations-via-php-api
Assigning relations via PHP API In order to set a Many-To-One data field, a single Pimcore element needs to be passed to the setter. With Many-To-Many and Many-To-Many Objects, an array of elements is passed to the setter: use Pimcore\Model\DataObject; use Pimcore\Model\Document; use Pimcore\Model\Asset; $object = DataObject::getById(12345); $object->setMyManyToOneField(Document::getById(23)); $object->setMyManyToManyField([ Asset::getById(350), DataObject::getByPath("/products/testproduct") ]); $object->setMyManyToManyObjectField([ DataObject\Product::getById(98), DataObject\Product::getById(99) ]); $object->save();
Assigning relations via PHP API
[ -0.31588214635849, 0.016026033088564873, -0.08326365053653717, 0.17866037786006927, 0.21499726176261902, -0.4182263910770416, 0.47883912920951843, -0.06179305911064148, -0.1611936390399933, 0.18771050870418549, 0.03344932571053505, 0.24115850031375885, 0.14142262935638428, 0.07363194227218...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#deleting-relations-via-php-api
Deleting relations via PHP API In order to remove all elements from this object's Many-To-Many field, the setter can be called with null or an array: $object->setMyManyToManyField([]); //that would have the same result $object->setMyManyToManyField(null); Internally the setter sets the value to an empty array, regardless if an empty array or null is passed to it.
Deleting relations via PHP API
[ 0.06512684375047684, -0.058164600282907486, -0.1938987523317337, 0.3002559244632721, -0.059607911854982376, -0.16110646724700928, 0.28525471687316895, 0.24263456463813782, 0.02887783944606781, 0.22393234074115753, -0.17827531695365906, 0.10333814471960068, -0.07573878020048141, -0.28360831...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#unpublished-relations
Unpublished relations Related items that are unpublished are normally not returned. You can disable this behavior like this: //also include unpublished relations form now on DataObject::setHideUnpublished(false); //get a related object that is either published or unpublished $relationObject = $relation->getObject(); //return to normal behavior DataObject::setHideUnpublished(true);
Unpublished relations
[ 0.0365314707159996, 0.07486133277416229, -0.1244502142071724, 0.4673653542995453, -0.20338408648967743, -0.4627646207809448, 0.17784233391284943, 0.25540268421173096, -0.17583099007606506, 0.2347557693719864, -0.252193421125412, -0.10304414480924606, 0.2027873694896698, -0.2619027495384216...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#allow-inline-download-of-asset
Allow inline download of asset You can enable inline download of assets from relations if you check the "Allow inline download" checkbox. If the relation is an asset, it will be directly downloaded. If the relation is a folder, a zip file will be downloaded.
Allow inline download of asset
[ -0.19799864292144775, -0.09485770016908646, -0.19549217820167542, 0.14707452058792114, -0.010802604258060455, -0.075454480946064, 0.15814295411109924, 0.21928243339061737, 0.0003928184160031378, 0.23017247021198273, -0.21260479092597961, 0.19284605979919434, 0.3226744532585144, 0.130071759...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#disable-clear-complete-relation
Disable clear complete relation If you want to disable the possibility to clear the whole relation, you can uncheck the checkbox "Allow to clear all relations of this field" in the classdefinition.
Disable clear complete relation
[ 0.00352513138204813, -0.12714257836341858, -0.17804054915905, 0.16768135130405426, 0.007324578240513802, -0.22360610961914062, 0.21703515946865082, 0.30817297101020813, 0.004383001942187548, 0.24786783754825592, -0.11518096178770065, 0.01626993529498577, 0.358340859413147, -0.0971174612641...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#advanced-many-to-one-object-relation
Advanced Many-To-One Object Relation This data type is an extension to the Many-To-One Object data type. To each assigned object additional metadata can be saved. The type of the metadata can be text, number, selection or a boolean value. A restriction of this data type is that only one allowed class is possible. As a result of this restriction, it is possible to show data fields of the assigned objects. Which metadata columns are available and which fields of the assigned objects are shown has to be defined during the class definition. The shown class definition results in the following object list in the object editor. The first two columns contain id and title of the assigned object. The other four columns are metadata columns and can be edited within this list. All the other functionality is the same as with the normal objects data type.
Advanced Many-To-One Object Relation
[ 0.1676090508699417, -0.1096462830901146, -0.06648574024438858, 0.385494589805603, 0.1154119223356247, -0.0028238266240805387, 0.27834323048591614, -0.018130600452423096, -0.15638068318367004, -0.009041364304721355, -0.3504263162612915, 0.17406852543354034, 0.035200513899326324, 0.085733033...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#access-objects-with-metadata-via-php-api
Access objects with metadata via PHP API use Pimcore\Model\DataObject; $object = DataObject::getById(73585); //getting list of assigned objects with metadata (array of DataObject\Data\ObjectMetadata) $objects = $object->getMetadata(); //get first object of list $relation = $objects[0]; //get relation object $relationObject = $relation->getObject(); //access meta data via getters (getter = key of metadata column) $metaText = $relation->getText(); $metaNumber = $relation->getNumber(); $metaSelect = $relation->getSelect(); $metaBool = $relation->getBool(); //setting data via setter $relation->setText("MetaText2"); $relation->setNumber(5512); $object->save();
Access objects with metadata via PHP API
[ -0.13762293756008148, -0.011961442418396473, -0.1848546713590622, 0.3669000566005707, 0.11684180796146393, -0.30328571796417236, 0.10953988134860992, 0.19053936004638672, -0.45910993218421936, 0.2075425535440445, -0.2315818816423416, 0.44862261414527893, 0.005780783481895924, 0.05281626433...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#save-objects-with-metadata
Save objects with metadata use Pimcore\Model\DataObject; //load your object (in this object we save the metadata objects) $object = DataObject::getById(73585); //create a empty array for your metadata objects $objectArray = []; //loop throu the objectlist (or array ...) and create object metadata foreach ($yourObjectsList as $yourObject) { //create the objectmetadata Object, "yourObject" is the referenced object $objectMetadata = new DataObject\Data\ObjectMetadata('metadata', ['text', 'number'], $yourObject); //set into the metadata field (named text) the value "Metadata" $objectMetadata->setText('Metadata'); //set into the metadata field (named Number) the value 23 $objectMetadata->setNumber(23); //add to the empty "objectArray" array $objectArray[] = $objectMetadata; } //set the metadataArray to your object $object->setMetadata($objectArray); // now save all $object->save();
Save objects with metadata
[ -0.2458905726671219, 0.023985324427485466, -0.14408764243125916, 0.2522309124469757, 0.20435985922813416, -0.12476401776075363, 0.15708698332309723, 0.19022788107395172, -0.32534050941467285, 0.30789080262184143, -0.29419243335723877, 0.4481619596481323, -0.22038111090660095, 0.05115786567...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#advanced-many-to-many-relation
Advanced Many-To-Many Relation This datatype is similar to the Advanced Many-To-One Object Relation data-type in the way that additional information can be added to the relation. The main difference is that all element types (documents, assets and objects) can be added to the relation list. The element types can also be mixed. Essentially, the same rules as for the standard Many-To-Many Relation apply. The API is nearly identical. However, instead of dealing with an ObjectMetadata class you have to do the same stuff with ElementMetadata. use Pimcore\Model\DataObject; use Pimcore\Model\Document; $referencedElement = Document::getById(123); $references = []; $elementMetadata = new DataObject\Data\ElementMetadata('metadata', ['text', 'number'], $referencedElement); //set into the metadata field (named text) the value "my lovely text" $elementMetadata->setText('my lovely text'); //set into the metadata field (named Number) the value 23 $elementMetadata->setNumber(23); $references[] = $elementMetadata; //set the metadata array to your object $object->setMetadata($references);
Advanced Many-To-Many Relation
[ -0.34398558735847473, 0.018882544711232185, -0.11309769749641418, 0.3143530488014221, 0.03594294562935829, -0.2070883959531784, 0.13953185081481934, 0.23380796611309052, -0.15247304737567902, 0.1936093270778656, -0.38640180230140686, 0.22248032689094543, -0.08861448615789413, 0.14181810617...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#lazy-loading
Lazy Loading Note that from 6.5.0 on relations are always lazy loaded. The configuration option has been removed. Whenever an object is loaded from database or cache, all these related objects are loaded with it. Especially with Many-To-Many relations it is easy to produce a huge amount of relations, which makes the object or an object list slow in loading. As a solution to this dilemma, Many-To-Many relational data types can be classified as lazy loading in the class definition. Attributes which are lazy loaded, are only loaded from the database/cache when their getter is called. In the example above this would mean, that the Many-To-Many relational data is only loaded when calling $object->getMyManyToManyField();.
Lazy Loading
[ -0.268507719039917, -0.06269612908363342, -0.12668925523757935, 0.5519174933433533, 0.1209961324930191, -0.2614596486091614, 0.07510237395763397, 0.34027591347694397, 0.30427372455596924, 0.15123701095581055, -0.03940533101558685, -0.1531279981136322, 0.2689068615436554, -0.424389630556106...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Relation_Types#dependencies
Dependencies There are several object data types which represent a relation to an other Pimcore element. The pure relation types are Many-To-One Relation Many-To-Many Relation Advanced Many-To-Many Relation Many-To-Many Object Relation Advanced Many-To-One Object Relation Furthermore, the following data types represent a relation, but they are not reflected in the object_relation_.. tables, since they are by some means special and not pure relations. (One could argue that the image is, but for now it is not classified as a pure relation type) Image Link Wysiwyg All of these relations produce a dependency. In other words, the dependent element is shown in both element's dependencies tab and Pimcore issues a warning when deleting an element which has dependencies.
Dependencies
[ 0.16214701533317566, -0.3444611132144928, -0.06737089157104492, 0.3233376443386078, 0.08886749297380447, 0.052047763019800186, 0.22797717154026031, -0.0438602976500988, -0.1157723218202591, 0.015199385583400726, -0.1827213317155838, 0.2804914116859436, 0.13884027302265167, 0.05356867611408...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Reverse_Object_Relation_Type#reverse-object-relation-datatype
Reverse Object Relation Datatype Reverse Object Relation are the counter part to the Many-To-Many Object Relation & Many-To-One Object Relation fields. They allow to display and edit relations which are owned by a remote object. This is best explained with an example: Let's say there is a product, which has an Many-To-Many Object Relation field called accessories. The straight forward way of establishing a relation is to open a product and assign it it's accessories by dragging and dropping other products into the accessories field. If you now also want to be able to go to the accessory product and define which other products this is an accessory of, you'd have to set up a Reverse Object Relation field to do that. The reverse field needs to be configured with the remote class name and the field name of the objects field in the remote class. Having done that, you can not only assign accessories to a product, but you can also define of which other products the current one is an accessory of. The Reverse Object Relation field do not have a database column or any data storage at all. They are stored in the remote object and merely represent a different way of establishing data relations from within the dependent object. When an object is added to a Reverse Object Relation field, this means the object owning the relation is modified implicitly. If the owning object is open in Pimcore as well, Pimcore will warn you that you are about to modify an object that is already open. If the owning object is already open in the UI, it will have to be reloaded, before the new relation established by a remote object, becomes visible.
Reverse Object Relation Datatype
[ 0.11161983758211136, -0.36427244544029236, 0.0035022543743252754, 0.05755618214607239, -0.21899856626987457, -0.30848026275634766, 0.1813564896583557, -0.11284719407558441, -0.1962229609489441, 0.020690811797976494, -0.4514820873737335, 0.14818216860294342, 0.2597384452819824, -0.057444743...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Reverse_Object_Relation_Type#working-with-php-api
Working with PHP API Since Reverse Object Relation are owned by the remote object, they can only be set through the remote owner.
Working with PHP API
[ 0.10266254097223282, -0.1717994511127472, -0.2047353982925415, 0.012615267187356949, -0.28726911544799805, -0.4175606071949005, 0.45428431034088135, -0.009832920506596565, -0.03828655183315277, 0.1296960413455963, -0.005362539552152157, -0.046125393360853195, 0.20777757465839386, 0.0121930...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Reverse_Object_Relation_Type#get-relations-via-php-api
Get relations via PHP API In order to get the owner objects use the getter method: $ownerRelations = $object->getMyReverseObjectRelationField();
Get relations via PHP API
[ -0.11321099102497101, -0.017393160611391068, -0.2549212872982025, 0.5700797438621521, -0.23071882128715515, -0.2629242539405823, 0.13664694130420685, 0.13919048011302948, -0.016871709376573563, 0.2311830073595047, -0.16366370022296906, 0.014725594781339169, 0.08697491884231567, -0.24995625...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Select_Types#select-datatypes
Select Datatypes There are 7 different select widgets available. Except the Multiselect widgets, all of them are portrayed by an input field with a drop-down list of options. The database column type is VARCHAR for all select data types, TEXT for all multiselection types. The configured value (not the display value!) is stored in the database. In the case of multiselect, values are stored as a comma separated list. For select and multiselect the options can be defined with a value and display value in the class definition: Country and language have fixed option values. For the language field the options can be limited to available system languages. The country and language select field are also available as multi select fields. The user field has fixed values as well. It allows to select a user from all available Pimcore system users. Thereby a system user can be associated an object. For multiselect types there is extra configuration to set render type (list or tags) Object Editor view for List Render Type: Object Editor view for Tags Render Type:
Select Datatypes
[ -0.15370309352874756, -0.2371404469013214, -0.045184869319200516, 0.1918579638004303, 0.08653821796178818, -0.41008779406547546, 0.31353241205215454, -0.013535655103623867, 0.10368819534778595, 0.27726081013679504, -0.27989456057548523, 0.5771036744117737, 0.17492228746414185, 0.4237281978...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Select_Types#working-with-select-data-types-via-api
Working with select data types via API In order to set a select field's value programmatically, the value is simply passed to the setter. To set the values of a multiselect field, an array of values is passed to the setter. $object->setSelect("1"); $object->setMultiselect(["1","2"]); $object->setLanguage("en"); $object->setCountry("AU"); $object->setUser(1); $object->save(); If one needs to find out what options are available for a select field. This can be done by getting the field definition as follows: $fd = $object->getClass()->getFieldDefinition("multiselect"); $options = $fd->getOptions(); If one needs to find out what options are available for a select field inside an ObjectBrick. This can also be done by getting the field definition of the brick as follows: $fd = $brick->getDefinition()->getFieldDefinition("multiselect"); $options = $fd->getOptions(); The display name values can be obtained as follows: use Pimcore\Model\DataObject; ... $o = DataObject::getById(49); // for a (single) select data field $valuesSingle = DataObject\Service::getOptionsForSelectField($o, "select"); $selectedValueSingle = $valuesSingle[$o->getSelect()]; // for a multiselect data field $multiSelectFieldValues = DataObject\Service::getOptionsForMultiSelectField($o, "multiSelectField"); $selectedValues = array_map( static fn($value) => $multiSelectFieldValues[$value], $o->getMultiSelectField() ); // For PHP >= 7.4 $selectedValues = array_map( static function($value) use ($multiSelectFieldValues) { return $multiSelectFieldValues[$value]; }, $o->getMultiSelectField() ); // For PHP <= 7.3 To show the selected option's display name in a Twig template, first put the option values as a view variable inside the controller action: use Pimcore\Model\DataObject; ... $product = DataObject::getById(49); // for a select data field $colorOptions = DataObject\Service::getOptionsForSelectField($product, "color"); return $this->render('foo/bar.html.twig', ['colorOptions' => $colorOptions]); Then you can use it in the Twig view: {{ colorOptions[product.color] }}
Working with select data types via API
[ -0.5509018898010254, -0.12536455690860748, -0.10179683566093445, 0.200896754860878, 0.062219105660915375, -0.49671825766563416, 0.36915066838264465, 0.02169843390583992, -0.12096311897039413, 0.5668045282363892, -0.024986321106553078, 0.7265278697013855, 0.04554137587547302, 0.389898508787...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Structured_Table#structured-table
Structured Table
Structured Table
[ -0.07663215696811676, -0.41678300499916077, -0.4047190546989441, 0.32786130905151367, -0.06509863585233688, -0.06316043436527252, 0.14634954929351807, 0.12110591679811478, -0.09180302917957306, 0.13168826699256897, -0.15752427279949188, 0.025216231122612953, -0.09773211181163788, 0.5187248...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Structured_Table#add-structured-table-to-the-class
Add Structured Table to the Class Similar to the table widget, the structured table can hold structured data. But there are a few fundamental differences: The rows and columns are predefined and named. The data type per column can be defined. Possible data types are text, number and boolean. The data of a structured table can be accessed via getters and setters and is stored in a structured way in the database. You can add structured table component in a class definition: To define the table, you have to specify rows and columns headers which would be used to fill the structured table content. Now, you can use the table in your object, like below:
Add Structured Table to the Class
[ -0.16705861687660217, 0.02561742253601551, -0.18683688342571259, 0.26660585403442383, 0.11330071091651917, -0.23781685531139374, 0.23016519844532013, 0.2377626597881317, -0.12831011414527893, 0.3629763424396515, -0.1507682055234909, 0.30325058102607727, -0.09248261153697968, 0.387370467185...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Structured_Table#storage-of-structured-tables
Storage of Structured tables For each row and column combination a new column in table of the structured table containing class will be stored. So it will be a clear restriction not to use this type of structuring data in case of a bigger number of data rows or columns. By using this design the maximum number of columns per table should be taken into consideration because it could be a technical restriction for it.
Storage of Structured tables
[ 0.019851377233862877, -0.20861274003982544, -0.20643365383148193, 0.5213191509246826, 0.11292973160743713, 0.02863013744354248, 0.41719046235084534, -0.023923030123114586, -0.08902611583471298, 0.22016791999340057, -0.22108599543571472, -0.083640456199646, -0.008613656274974346, 0.35718765...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Structured_Table#using-structured-table-with-php-api
Using structured table with PHP API In the code, the data of this field can be accessed as shown in the code snippets, below: /** @var \Pimcore\Model\DataObject\Data\StructuredTable $structuredData */ $structuredData = $object->getAdditionalinfo(); //Returns an associated array of row CommunityEdition with all columns $structuredData->getCommunityedition(); //Returns an associated array of row CommunityEdition with all columns $structuredData->getCommunityedition__support(); //Delivers an associated array of row CommunityEdition with all columns $structuredData->setCommunityedition__support("Forum"); //Alternative way of setting data to a structured table $data = []; $data['communityedition']['opensource'] = true; $structuredData->setData($data);
Using structured table with PHP API
[ -0.5241426229476929, 0.10571707040071487, -0.28771692514419556, 0.4636765420436859, 0.09298230707645416, -0.27895620465278625, -0.028824983164668083, 0.20138172805309296, -0.18556970357894897, 0.22565996646881104, -0.2448333501815796, 0.4461243152618408, 0.25816673040390015, 0.193076580762...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Structured_Table#using-copy-and-paste-feature-in-an-object-using-table-data-type
Using copy and paste feature in an object using table data type A copy and paste feature is available to be able to fill easily the table in an object from an Excel sheet for instance: It is possible to copy directly data in the OS clipboard from Excel: And after pasting data will be formatted keeping Excel structure: You can paste any data (from text files, etc.), separator must be tabulation.
Using copy and paste feature in an object using table data type
[ -0.0033744778484106064, -0.27544835209846497, -0.17388026416301727, -0.020246947184205055, -0.1302822232246399, -0.291930615901947, -0.03954729437828064, 0.2826911509037018, -0.3783479630947113, 0.2612155079841614, 0.02756587602198124, 0.2875954806804657, 0.2544204294681549, 0.490883708000...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Table#table
Table The table widget can hold structured data in the form of an array. The input widget for table data is a table with variable rows and columns as shown below. The data is stored in an array, which needs to be flattened for storage in the database. For this purpose columns are separated with a "|" and rows are distinguished with line breaks. The database field for a table is a TEXT column. For example, the data shown in the screen above would be stored as: one|two|three four|five|six seven|eight|nine The input widget can be preconfigured with default data or a fixed amount of rows and columns. The default amount of rows and columns, as well as the default data, can be changed later when the data is entered. It's possible to prevent adding/removing additional rows/columns by setting the "Rows fixed"/"Cols fixed" checkbox. If this is set to fixed the add and delete button for rows and columns will disappear. In order to set table data programmatically, an array needs to be passed to the setter as shown in the code snippet below: $object->setTable([ ["one", "two", "three"], ["four", "five", "six"], ["seven", "eight", "nine"] ]);
Table
[ -0.1552087366580963, 0.06080656871199608, -0.14708572626113892, 0.24184265732765198, 0.0709424763917923, -0.2845178544521332, 0.08379004150629044, 0.23921650648117065, 0.07788063585758209, 0.35158801078796387, -0.0037268176674842834, 0.32975780963897705, -0.1145939901471138, 0.478475093841...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Text_Types#text-datatypes
Text Datatypes
Text Datatypes
[ -0.1254226416349411, -0.370035320520401, -0.35447612404823303, 0.38736820220947266, 0.26126137375831604, -0.08430799841880798, 0.39189234375953674, -0.019532019272446632, 0.016988173127174377, -0.07913681119680405, -0.19266091287136078, -0.2765465974807739, -0.015137744136154652, 0.4404710...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Text_Types#input
Input The input field is a simple text input field. It's data is stored in a VARCHAR column in the database. The display width and database column length can be configured in the object class definition. To set the value of an input field, the string value needs to be passed to the setter. $object->setInput("Some Text"); $object->save();
Input
[ -0.21455763280391693, -0.27949729561805725, -0.17155663669109344, 0.39961764216423035, 0.16214878857135773, -0.268224835395813, 0.008000600151717663, 0.08218121528625488, -0.07910913974046707, 0.4153127372264862, 0.29428884387016296, -0.10707875341176987, 0.22231067717075348, 0.27135130763...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Text_Types#password
Password The password field is basically the same as the input field with hidden input characters. It's column length can not be changed, since passwords are always hashed using the selected algorithm. If a string appears to already be hashed, either by detection by password_get_info() or if it matches any common hash patterns below, then it will not be hashed again. Hexadecimal string with legth of 32, 40, 48, 56, 64, 96, or 128 characters These rules will detect the following hashes: MD2, MD4, MD5, RIPEMD-128, Snefru 128, Tiger/128, HAVAL128 SHA-1, HAS-160, RIPEMD-160, Tiger/160, HAVAL160 Tiger/192, HAVAL192 SHA-224, HAVAL224 SHA-256, BLAKE-256, GOST, GOST CryptoPro, HAVAL256, RIPEMD-256, Snefru 256 SHA-384 SHA-512, BLAKE-512, SWIFFT We recommend using password_hash as algorithm.
Password
[ 0.2382410317659378, -0.47274601459503174, -0.18761670589447021, 0.05767038092017174, 0.27559879422187805, -0.4074677526950836, 0.3514859080314636, -0.07656490057706833, 0.019941527396440506, 0.04614783450961113, 0.31369897723197937, -0.17371739447116852, 0.18073728680610657, 0.033538527786...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Text_Types#textarea
Textarea The textarea is an input widget for unformatted plain text. It is stored in a TEXT column in the database. Setting it's value works the same as for the input field. The width and height of the input widget can be configured in the object field definition.
Textarea
[ -0.03454974666237831, -0.45015954971313477, -0.11845046281814575, 0.1557348221540451, 0.0626537874341011, -0.3255905508995056, 0.4251376986503601, 0.018024850636720657, -0.10644584149122238, 0.14008796215057373, -0.035554926842451096, -0.18747681379318237, 0.37052586674690247, 0.2720127999...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Text_Types#wysiwyg
WYSIWYG The WYSIWYG (What You See Is What You Get) input field is identical with the textarea field except for the fact that it's input widget allows formatting of text and can even hold images and links (references to assets and documents). If images and documents are used in a WYSIWYG widget, they create a dependency for the current object. To insert an image, assets can be dragged to a WYSIWYG widget. In order to create a link, a document needs to be dragged and dropped on selected text in the WYSIWYG widget. The text is stored as HTML.
WYSIWYG
[ 0.2515685558319092, -0.5348045229911804, -0.04700925946235657, 0.01580057293176651, 0.0061649964191019535, -0.1348482221364975, 0.5625750422477722, 0.06061127781867981, 0.15737509727478027, -0.037072282284498215, 0.08445645868778229, 0.11092759668827057, 0.329795241355896, 0.03965272009372...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Text_Types#input-quantity-value
Input Quantity Value Quite similar to Quantity Value except that text values are allowed instead of the strict restriction to numeric values.
Input Quantity Value
[ -0.11774709075689316, -0.47226154804229736, -0.3479134738445282, -0.17743439972400665, 0.03935866802930832, -0.42458879947662354, 0.23486396670341492, -0.03204723820090294, -0.21882861852645874, 0.49758923053741455, -0.03800937160849571, 0.11854950338602066, -0.05808887258172035, 0.5070263...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Video_Type#video-datatype
Video Datatype
Video Datatype
[ -0.3685580790042877, -0.3263227045536041, -0.2532062828540802, 0.2394866645336151, 0.3370864689350128, -0.183577299118042, 0.1856396496295929, 0.23931609094142914, -0.3062557578086853, -0.22285966575145721, -0.04448268562555313, -0.1669786423444748, -0.10121013969182968, 0.5534024834632874...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Video_Type#working-with-php-api
Working with PHP API <?php $object = DataObject::getById(1234); print_r($object->getMyVideo()); ?> Will produce the following output depending on the content: # ASSET VIDEO Pimcore\Model\DataObject\Data\Video Object ( [type] => asset [data] => Pimcore\Model\Asset\Video Object ( [type] => video [id] => 27 ... ) [poster] => Pimcore\Model\Asset\Image Object ( [type] => image [id] => 284 ... ) [title] => My Title [description] => My Description ) # YouTube Video Pimcore\Model\DataObject\Data\Video Object ( [type] => youtube [data] => pAE_ff8tV-g [poster] => [title] => My Title [description] => My Description ) # Vimeo Video Pimcore\Model\DataObject\Data\Video Object ( [type] => vimeo [data] => 11696823 [poster] => [title] => My Title [description] => My Description )
Working with PHP API
[ -0.10073671489953995, -0.0966000184416771, -0.2909638285636902, 0.24626249074935913, 0.12418718636035919, -0.3138440251350403, 0.17685696482658386, 0.4158605933189392, -0.22036322951316833, 0.03413848206400871, 0.09753657132387161, 0.24062807857990265, -0.1120605617761612, 0.16415847837924...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Video_Type#display-video-using-document's-video-tag
Display Video using document's video tag <?php $object = DataObject::getById(1234); $v = $object->getMyVideo(); $videoData = $v->getData(); if($videoData) { $video = new \Pimcore\Model\Document\Editable\Video(); $video->setConfig([ "thumbnail" => "myVideoThumb", // specify your thumbnail here - IMPORTANT! "width" => "100%", "height" => 480, "attributes" => ["class" => "video-js custom-class", "preload" => "auto", "controls" => "", "data-custom-attr" => "my-test"] ]); $video->setType($v->getType()); $video->setTitle($v->getTitle()); $video->setDescription($v->getDescription()); $video->setId(($videoData instanceof Asset) ? $videoData->getId() : $videoData); if($v->getPoster()) { $video->setPoster($v->getPoster()->getId()); } echo $video->frontend(); }
Display Video using document's video tag
[ -0.35973110795021057, -0.19180293381214142, -0.25989386439323425, -0.052861571311950684, 0.22000254690647125, -0.30533260107040405, 0.26209214329719543, 0.4695020914077759, -0.32667651772499084, 0.11238313466310501, -0.1320817619562149, 0.43134158849716187, 0.0595044307410717, 0.1380054205...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types/Video_Type#setting-data-to-the-video-data-type
Setting data to the video data type <?php // asset video with poster image $object = DataObject::getById(789); $assetVideo = Asset::getById(123); $assetImage = Asset::getById(456); $videoData= new DataObject\Data\Video(); $videoData->setData($assetVideo); $videoData->setType("asset"); $videoData->setPoster($assetImage); $videoData->setTitle("My Title"); $videoData->setDescription("My Description"); $object->setMyVideo($videoData); $object->save();
Setting data to the video data type
[ -0.2580469250679016, 0.029308730736374855, -0.20618359744548798, 0.13508428633213043, 0.22411884367465973, -0.19731563329696655, 0.17956992983818054, 0.4014267325401306, -0.4677184820175171, 0.012262819334864616, 0.06611558049917221, -0.1990145444869995, -0.005799926817417145, 0.0535626970...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types#object-data-types
Object Data Types The entire list of data types is indicated below:
Object Data Types
[ -0.08336105197668076, -0.3425244390964508, -0.3429836332798004, 0.3060665428638458, 0.19121013581752777, -0.1038118377327919, 0.15964990854263306, -0.008895937353372574, 0.0002661226026248187, 0.02215052768588066, -0.19268004596233368, 0.1297702044248581, -0.08940795809030533, 0.3174001276...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types#text-datatypes
Text Datatypes Name Description input text input field textarea textarea wysiwyg text area with formatting options through a WYSIWYG editor password password field
Text Datatypes
[ 0.0003803432919085026, -0.2594386041164398, -0.16956664621829987, -0.023224974051117897, 0.21424829959869385, -0.0757627934217453, 0.5900381207466125, 0.12614166736602783, -0.1808631718158722, 0.06329677999019623, 0.08885779976844788, -0.02126583643257618, 0.06788895279169083, 0.4120882749...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types#number-datatypes
Number Datatypes Name Description numeric spinner field for number input slider number input with slider widget (min - max slider) quantity value number input with an additional unit. available units can be configured centrally.
Number Datatypes
[ -0.25429534912109375, -0.5341335535049438, -0.187320739030838, 0.1765606701374054, 0.2444915622472763, -0.08297153562307358, 0.5250987410545349, -0.00887951161712408, -0.10421602427959442, 0.28811222314834595, 0.08431228250265121, 0.013596994802355766, -0.01512480340898037, 0.3738680183887...
https://pimcore.com/docs/platform//Pimcore/Objects/Object_Classes/Data_Types#date-datatypes
Date Datatypes Name Description date calendar date selector date & time calendar date selector + combo box for time time combo box for time
Date Datatypes
[ -0.18192794919013977, -0.11531980335712433, -0.24160882830619812, 0.17465735971927643, 0.12884210050106049, 0.1445653885602951, 0.16795459389686584, 0.255674809217453, -0.15647752583026886, 0.040628936141729355, -0.046942126005887985, -0.11773400008678436, -0.012909877113997936, 0.26764500...