url stringlengths 50 196 | text stringlengths 3 17.2k | heading stringlengths 2 103 | embeddings list |
|---|---|---|---|
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Embed#methods | Methods
Name
Return
Description
isEmpty()
boolean
Whether the editable is empty or not
getData()
string
Get the URL of the assigned resource
| Methods | [
0.36424168944358826,
-0.46389737725257874,
-0.3008574843406677,
0.06612728536128998,
0.09410673379898071,
-0.19411475956439972,
0.033423472195863724,
0.35608622431755066,
-0.3860815763473511,
0.03977731987833977,
-0.33048561215400696,
0.41622278094291687,
-0.09753508865833282,
0.0144584141... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Embed#example | Example
{# Basic usage #}
{{ pimcore_embed("socialWidgets") }}
{# Advanced usage #}
{{ pimcore_embed("socialWidgets", { "width": 540 }) }}
| Example | [
-0.19783952832221985,
-0.9476523399353027,
-0.2279648333787918,
0.08788664638996124,
0.14556074142456055,
-0.3152056932449341,
0.3386448621749878,
-0.022440193220973015,
-0.05038312077522278,
0.18921756744384766,
0.18790100514888763,
0.12069801986217499,
0.09658581018447876,
0.340226024389... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/PDF#pdf-editable | PDF Editable
This editable requires Ghostscript installed on your server.
See System Requirements
| PDF Editable | [
-0.20217087864875793,
-0.3438219726085663,
-0.20940247178077698,
-0.1545567661523819,
-0.1445731222629547,
-0.1249004676938057,
0.09238511323928833,
0.25037074089050293,
0.05250707268714905,
0.20831921696662903,
-0.05760112777352333,
0.41648462414741516,
-0.1579221934080124,
0.455575108528... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/PDF#general | General
The PDF editable allows you to embed asset documents (pdf, doc, xls, ...) into documents. | General | [
0.013244016095995903,
-0.3677418828010559,
-0.28187230229377747,
-0.1903103142976761,
0.08973946422338486,
0.1900583952665329,
0.09460601955652237,
0.3449566662311554,
-0.24496135115623474,
0.29219916462898254,
-0.23317478597164154,
0.46989864110946655,
-0.03027762845158577,
0.196703702211... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/PDF#configuration | Configuration
Name
Type
Description
thumbnail
string/array
Thumbnail config (name or array) for the preview image
uploadPath
string
Target path for (inline) uploaded images
| Configuration | [
0.057117998600006104,
-0.360979288816452,
-0.2110346108675003,
-0.25473693013191223,
-0.002767565893009305,
-0.03484393283724785,
0.4565757215023041,
0.031808748841285706,
-0.0564873106777668,
0.1439572423696518,
0.09449568390846252,
-0.004433322697877884,
-0.0676802545785904,
0.2316407412... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/PDF#methods | Methods
Name
Return
Description
getData()
array
Returns all stored data for this editable
isEmpty()
boolean
Whether the editable is empty or not
getElement()
Asset
Returns the assigned Asset Document
| Methods | [
0.35668835043907166,
-0.1543082445859909,
-0.36387163400650024,
0.12626966834068298,
0.1160367950797081,
-0.08405181020498276,
0.17918218672275543,
0.4830532968044281,
-0.06959670782089233,
0.04201488196849823,
-0.45012518763542175,
0.45161744952201843,
0.047431860119104385,
0.056527387350... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/PDF#examples | Examples | Examples | [
0.1105974018573761,
-0.41019901633262634,
-0.28510186076164246,
0.1324809491634369,
-0.13995729386806488,
-0.14305032789707184,
0.3125857710838318,
0.14037898182868958,
-0.0417528860270977,
0.3020334243774414,
0.41210994124412537,
0.22653697431087494,
-0.10223178565502167,
-0.0599273890256... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/PDF#basic-usage | Basic usage
<div class="pdf">
{{ pimcore_pdf("myPdf", {"width": 640}) }}
</div>
This looks like the following in editmode:
A user can now drag documents there from the Assets tree:
| Basic usage | [
-0.15244852006435394,
-0.23049072921276093,
-0.12037188559770584,
0.017354970797896385,
-0.017674269154667854,
-0.30030766129493713,
0.052490197122097015,
0.317672461271286,
-0.7119945883750916,
0.1277424693107605,
-0.1022680401802063,
0.44447529315948486,
0.14912423491477966,
-0.148887813... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Renderlet#renderlet-editable | Renderlet Editable | Renderlet Editable | [
-0.07537729293107986,
-0.405211865901947,
-0.23619422316551208,
0.10675282031297684,
0.201158806681633,
-0.13535882532596588,
0.13887809216976166,
0.36753273010253906,
-0.041477594524621964,
0.2068684846162796,
-0.3572724461555481,
0.3831900358200073,
0.02527417615056038,
-0.16483139991760... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Renderlet#general | General
The renderlet is a special container which is able to handle every element in Pimcore (Documents, Assets, Objects).
You can decide in your controller/action what to do with the element which is linked to the renderlet.
So it's possible to make a multifunctional area in editmode where the editor can drop anything on it.
A typical use-case would be to render product objects within a document. | General | [
-0.0727529302239418,
-0.5240978002548218,
-0.15102967619895935,
0.11925052851438522,
-0.17062152922153473,
-0.2191954106092453,
0.24171973764896393,
0.27432316541671753,
-0.3458048403263092,
0.043390531092882156,
-0.3195531964302063,
0.5912303328514099,
0.163337841629982,
0.082916438579559... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Renderlet#configuration | Configuration
Name
Type
Description
Mandatory
controller
string
Specify controller reference, e.g. App\Controller\FooController::myAction
X
template
string
Specify template
className
string or string[]
Specify class name (if type object chosen) as single string or as string array
height
integer or string
Height of the renderlet in pixel or 'auto'
reload
bool
Reload document on change
title
string
Add a title to the box in editmode
type
string
The type of the element assigned to the renderlet (document,asset,object)
width
integer
Width of the renderlet in pixel
class
string
A CSS class that is added to the surrounding container of this element in editmode
Optionally you can pass every parameter (with a scalar data type) you like to the renderlet which can be accessed in
the configured controller with $request->get('yourKey'). | Configuration | [
-0.00384235056117177,
-0.2682299315929413,
-0.1105133593082428,
0.10419684648513794,
0.05523622781038284,
-0.2664490044116974,
0.10133170336484909,
0.34595367312431335,
-0.3096245527267456,
0.1877681314945221,
0.14542867243289948,
0.31216713786125183,
0.10808132588863373,
0.196663394570350... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Renderlet#methods | Methods
Name
Return
Description
isEmpty()
bool
Whether the editable is empty or not.
| Methods | [
0.36723241209983826,
-0.4283234477043152,
-0.220800518989563,
-0.04049796238541603,
-0.027458224445581436,
-0.13544629514217377,
0.12787140905857086,
0.2916136682033539,
-0.3797428607940674,
0.2337004542350769,
-0.1533452421426773,
0.1863575428724289,
-0.2014579325914383,
0.079946786165237... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Renderlet#in-the-configured-controller-action | In the configured Controller Action
In the target controller action, you get the following parameters which can be accessed by $request->get('key').
Name
Type
Description
id
integer
The id of the element assigned to the renderlet
type
string
The type of the element assigned to the renderlet (document,asset,object)
subtype
string
The subtype of the element assigned to the renderlet (folder, image, link, page, classname, ...)
If you have defined any custom parameters on the renderlet configuration you can access them also with $request->get('yourParam'). | In the configured Controller Action | [
-0.136999249458313,
-0.47667819261550903,
-0.1759936511516571,
0.39084839820861816,
-0.029478227719664574,
-0.19146345555782318,
-0.007602204568684101,
0.2328152060508728,
-0.129518061876297,
0.051455192267894745,
-0.2247803509235382,
0.20276613533496857,
0.0921730250120163,
-0.02341207116... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Renderlet#example | Example
The code below shows how to use renderlet to create gallery based on it. | Example | [
-0.27505823969841003,
-0.33784931898117065,
-0.2888079285621643,
0.3137930929660797,
-0.12646886706352234,
-0.1150086373090744,
0.16444014012813568,
0.3922182321548462,
-0.016734575852751732,
0.1906593292951584,
-0.06325946748256683,
0.34253138303756714,
0.022166933864355087,
-0.0169848129... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Renderlet#specify-the-renderlet-editable-in-a-template | Specify the Renderlet Editable in a Template
<section id="renderlet-gallery">
{{
pimcore_renderlet('myGallery', {
"controller" : "App\\Controller\\ContentController::myGalleryAction",
"title" : "Drag an asset folder here to get a gallery",
"height" : 400
})
}}
</section>
Now editors are able to put elements onto the renderlet in the editmode.
| Specify the Renderlet Editable in a Template | [
-0.12643222510814667,
-0.12383954226970673,
-0.15703988075256348,
0.012102562002837658,
0.11833103746175766,
-0.29695263504981995,
0.03625436872243881,
0.25746583938598633,
-0.39059513807296753,
0.2723662853240967,
-0.32148730754852295,
0.7940999269485474,
0.10588692873716354,
0.0334002450... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Renderlet#specify-the-controller-action | Specify the Controller Action
#[Template('my-gallery.html.twig')]
public function myGalleryAction(Request $request): array
{
if ('asset' === $request->get('type')) {
$asset = Asset::getById((int) $request->get('id'));
if ('folder' === $asset->getType()) {
return [
'assets' => $asset->getChildren()
];
}
}
return [];
}
The action is responsible for validation and transferring assets to the view.
Of course, to limit access to the renderlet, you can use the type configuration option as well. | Specify the Controller Action | [
0.0027364734560251236,
0.10047496855258942,
-0.1122947558760643,
0.44733351469039917,
0.016872551292181015,
-0.1532624363899231,
0.05645263195037842,
0.565100371837616,
0.09779447317123413,
0.02573738805949688,
-0.38874444365501404,
0.16609586775302887,
-0.08669433742761612,
-0.33908721804... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Renderlet#create-view | Create View
Now you have to create the template file at: templates/content/my_gallery.html.twig
{% if assets %}
<div class="my-gallery">
{% for asset in assets %}
{% if asset is instanceof('\\Pimcore\\Model\\Asset\\Image') %}
<div class="gallery-row">
{{ asset.getThumbnail('myThumbnailName').getHTML()|raw }}
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
And the final view is like, below:
| Create View | [
-0.01048278622329235,
0.023946968838572502,
-0.16260285675525665,
0.18816369771957397,
-0.023462211713194847,
-0.017038125544786453,
0.11523155122995377,
0.5352790355682373,
-0.2060658484697342,
0.12389564514160156,
-0.2616454064846039,
0.42884814739227295,
-0.06748002767562866,
-0.0853977... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Renderlet#editmode | Editmode
Please be aware, that the renderlet itself is not editmode-aware. If you need to determine within the renderlet whether in editmode or not, you need to pass that parameter to the renderlet.
{{
pimcore_renderlet('myRenderlet', {
....
"editmode" : editmode
})
}}
Within the renderlet, you can access the editmode parameter as follows:
{% if editmode %}
| Editmode | [
-0.3495587110519409,
-0.6179813742637634,
-0.14690610766410828,
0.0012214700691401958,
0.03118288703262806,
-0.38014182448387146,
0.1001814529299736,
0.32170888781547546,
-0.2968694269657135,
0.06085652485489845,
-0.2083011418581009,
0.6874051094055176,
0.09710497409105301,
-0.271054655313... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Select#select-editable | Select Editable | Select Editable | [
-0.027558453381061554,
-0.1631680428981781,
-0.30120399594306946,
-0.09822682291269302,
0.2772185504436493,
-0.14686624705791473,
-0.12179746478796005,
0.057497087866067886,
-0.1330464780330658,
0.43395644426345825,
-0.4222695529460907,
0.5874674320220947,
-0.14749817550182343,
0.155913129... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Select#general | General
The select editable generates select-box component in Editmode. | General | [
-0.21510888636112213,
-0.20146644115447998,
-0.16187290847301483,
-0.26146629452705383,
0.1195150688290596,
-0.1405704915523529,
0.3033052384853363,
0.11258097738027573,
-0.283059686422348,
0.14523816108703613,
-0.09959881007671356,
0.4984494745731354,
-0.06188575178384781,
0.4399005174636... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Select#configuration | Configuration
Name
Type
Description
store
array
Key/Value pairs for the available options.
reload
bool
Set true to reload the page in editmode after selecting an item
width
integer
Width of the select box in pixel
class
string
A CSS class that is added to the surrounding container of this element in editmode
defaultValue
string
A default value for the available options. Note: This value needs to be saved before calling getData() or use setDataFromResource().
required
boolean
(default: false) set to true to make field value required for publish
editable
boolean
(default: false) set to true to allow custom option
| Configuration | [
-0.0450521744787693,
-0.4789188802242279,
-0.15066233277320862,
-0.2962784171104431,
0.11246396601200104,
-0.2261354774236679,
0.07833492010831833,
0.1176697313785553,
-0.2910917103290558,
0.15226271748542786,
0.09459169209003448,
0.32675281167030334,
0.1903916448354721,
0.5669724941253662... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Select#methods | Methods
Name
Return
Description
getData()
string
Value of the select, this is useful to get the value even in editmode
isEmpty()
bool
Whether the editable is empty or not.
| Methods | [
0.13579529523849487,
-0.24287846684455872,
-0.245464026927948,
-0.05234774947166443,
0.11766001582145691,
-0.1513141393661499,
-0.006046594586223364,
0.3004191517829895,
-0.3942786753177643,
0.2394561767578125,
-0.35083943605422974,
0.6418393850326538,
0.0027536735869944096,
0.161920160055... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Select#examples | Examples | Examples | [
0.1105974018573761,
-0.41019901633262634,
-0.28510186076164246,
0.1324809491634369,
-0.13995729386806488,
-0.14305032789707184,
0.3125857710838318,
0.14037898182868958,
-0.0417528860270977,
0.3020334243774414,
0.41210994124412537,
0.22653697431087494,
-0.10223178565502167,
-0.0599273890256... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Select#basic-usage | Basic Usage
The code below shows a select box in editmode,
in the frontend preview you will see simply the value of the chosen option.
{% if editmode %}
{{ pimcore_select("valid_for", {
"store": [
["one-month", "One month"],
["three-months", "Three months"],
["unlimited", "Unlimited"]
],
"defaultValue" : "unlimited"
}) }}
{% else %}
<p>
{{ "Something is valid for" | trans }}:{{ pimcore_select("valid_for").getData() | trans }}
</p>
{% endif %}
Editmode:
Frontend:
| Basic Usage | [
-0.3062446713447571,
-0.37982168793678284,
-0.20727421343326569,
-0.05487201362848282,
0.02631106972694397,
-0.4004097580909729,
0.08683553338050842,
0.10440181940793991,
-0.27800676226615906,
0.2761423587799072,
0.09912524372339249,
0.5295140743255615,
0.16926077008247375,
0.4876949787139... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Select#preselect-the-option | Preselect the option
You can preselect an option in your select editable by using setDataFromResource()
{% if editmode %}
{% if pimcore_select('valid_for').isEmpty() %}
{% do pimcore_select('valid_for').setDataFromResource('unlimited') %}
{% endif %}
...
{% endif %}
| Preselect the option | [
-0.33472052216529846,
-0.27125972509384155,
-0.16536842286586761,
-0.2988623380661011,
0.14723332226276398,
-0.4180959463119507,
-0.08370529115200043,
-0.0582561232149601,
-0.3097545802593231,
0.4457373023033142,
-0.12059921026229858,
0.5599907040596008,
-0.06956277787685394,
0.29016360640... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Snippet#snippet-editable | Snippet Editable | Snippet Editable | [
0.16721928119659424,
-0.27059781551361084,
-0.34073469042778015,
-0.12186025828123093,
0.11127304285764694,
-0.26964858174324036,
0.05985991284251213,
0.052354127168655396,
-0.4472198486328125,
0.3998448848724365,
-0.3681379556655884,
0.603440523147583,
-0.10029422491788864,
0.337886780500... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Snippet#general | General
Use the snippet editable to embed a document snippet, for example teasers or other boxes into your document.
Snippets are like little pages which can be embedded in other documents.
You have to create them the same way as other documents (pages). | General | [
0.07118819653987885,
-0.3430286645889282,
-0.2073419988155365,
-0.12413601577281952,
-0.12142205983400345,
-0.12026695907115936,
0.13953909277915955,
0.16974353790283203,
-0.29995912313461304,
0.37183767557144165,
-0.0005337464390322566,
0.5331161618232727,
-0.14610300958156586,
0.30843809... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Snippet#configuration | Configuration
Name
Type
Description
defaultHeight
integer
A default height if the element is empty
height
integer
Height of the snippet in pixel
reload
bool
Reload document on change
title
string
You can give the element a title
width
integer
Width of the snippet in pixel
class
string
A CSS class that is added to the surrounding container of this element in editmode
cache
bool
Enable cache for rendered snippet
| Configuration | [
-0.06511694192886353,
-0.4268610179424286,
-0.1628246009349823,
-0.07789647579193115,
0.09015906602144241,
-0.31848299503326416,
0.20115742087364197,
0.2033197581768036,
-0.48449745774269104,
0.42342790961265564,
0.14399847388267517,
0.17842896282672882,
0.20544297993183136,
0.269487708806... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Snippet#methods | Methods
Name
Return
Description
getId()
int
ID of the assigned snippet
getSnippet()
Snippet
The assigned snippet object
isEmpty()
bool
Whether the editable is empty or not.
| Methods | [
0.30215221643447876,
-0.415486603975296,
-0.23669777810573578,
0.002229781821370125,
-0.029100429266691208,
-0.25325265526771545,
0.09442675113677979,
0.26872286200523376,
-0.3121567964553833,
0.27089446783065796,
-0.3339461088180542,
0.5788255333900452,
-0.18393485248088837,
0.13887579739... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Snippet#examples | Examples | Examples | [
0.1105974018573761,
-0.41019901633262634,
-0.28510186076164246,
0.1324809491634369,
-0.13995729386806488,
-0.14305032789707184,
0.3125857710838318,
0.14037898182868958,
-0.0417528860270977,
0.3020334243774414,
0.41210994124412537,
0.22653697431087494,
-0.10223178565502167,
-0.0599273890256... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Snippet#basic-usage | Basic Usage
{{ pimcore_snippet("mySnippet", {"width": 250, "height": 100}) }}
| Basic Usage | [
-0.40530192852020264,
-0.503385603427887,
-0.2365579903125763,
-0.0886458232998848,
0.0254244152456522,
-0.6531854867935181,
0.18434885144233704,
0.14274542033672333,
-0.5462605953216553,
0.38607150316238403,
-0.08923045545816422,
0.5584511756896973,
0.031706977635622025,
0.493773192167282... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Snippet#caching | Caching
By default caching is disabled.
You can enable snippet caching by passing the configuration cache: true or
by enabling the full page cache.
Regardless if you're using the full page cache or not it's a good practice to
enable the cache directly on the editable if the snippet result should be cached.
{{ pimcore_snippet("mySnippet", {cache: true}) }}
| Caching | [
-0.3022848963737488,
-0.22269755601882935,
-0.12487529218196869,
-0.1223258301615715,
0.008957349695265293,
-0.4435807168483734,
0.06307384371757507,
0.24922147393226624,
-0.5679305195808411,
0.19300515949726105,
-0.24305450916290283,
0.8486889600753784,
0.1310233175754547,
0.1322189569473... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Table#table-editable | Table Editable | Table Editable | [
0.10337197035551071,
-0.13980771601200104,
-0.3945757746696472,
0.02279800735414028,
0.12102176249027252,
0.08626079559326172,
-0.1941288411617279,
0.22717949748039246,
-0.16804032027721405,
0.35740119218826294,
-0.4407396912574768,
0.38870301842689514,
-0.058241065591573715,
0.14076904952... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Table#general | General
The table editable provides the ability to edit a table structure. | General | [
-0.020929379388689995,
-0.1359466016292572,
-0.378985196352005,
-0.174903005361557,
-0.018149081617593765,
0.21419620513916016,
-0.12029094994068146,
0.14701887965202332,
-0.25874757766723633,
0.25239723920822144,
-0.35311517119407654,
0.29351794719696045,
-0.021326517686247826,
0.22068417... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Table#configuration | Configuration
Name
Type
Description
defaults
array
Array can have the following properties: rows, cols, data (see example)
width
integer
Width of the field in pixel
class
string
A CSS class that is added to the surrounding container of this element in editmode
| Configuration | [
0.07932911068201065,
-0.5685564875602722,
-0.30588093400001526,
0.04150533676147461,
0.2539440095424652,
0.1101437658071518,
0.3937903344631195,
-0.017431989312171936,
-0.12659071385860443,
0.31124934554100037,
0.06079760938882828,
0.017738062888383865,
-0.03777941316366196,
0.143841445446... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Table#methods | Methods
Name
Return
Description
getData()
array
Get the data of the table as array
isEmpty()
bool
Whether the editable is empty or not.
| Methods | [
0.2644575834274292,
-0.362630158662796,
-0.37600257992744446,
0.02052718959748745,
-0.09929335862398148,
-0.09001784771680832,
-0.12763871252536774,
0.33732593059539795,
-0.15411604940891266,
0.20192885398864746,
-0.3447020649909973,
0.44570067524909973,
-0.13452653586864471,
0.13427306711... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Table#examples | Examples | Examples | [
0.1105974018573761,
-0.41019901633262634,
-0.28510186076164246,
0.1324809491634369,
-0.13995729386806488,
-0.14305032789707184,
0.3125857710838318,
0.14037898182868958,
-0.0417528860270977,
0.3020334243774414,
0.41210994124412537,
0.22653697431087494,
-0.10223178565502167,
-0.0599273890256... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Table#basic-usage | Basic usage
{{ pimcore_table("productProperties", {
"width": 700,
"height": 400,
"defaults": {
"cols": 2,
"rows": 3,
"data": [
["Attribute name", "Value"],
["Color", "Black"],
["Size", "Large"],
["Availability", "Out of stock"]
]
}
})
}}
You're now able to change columns and the predefined data in the editmode.
| Basic usage | [
-0.14219433069229126,
-0.1832636147737503,
-0.2610093653202057,
0.1127345860004425,
0.15870483219623566,
-0.2287367880344391,
0.12433724105358124,
0.16322490572929382,
-0.5422145128250122,
0.23818157613277435,
-0.4532908797264099,
0.677528440952301,
0.32851865887641907,
0.6513208150863647,... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Table#processing-the-data | Processing the Data
Sometimes you need use only the data from a filled table.
You would just use the getData() method instead of rendering the entire HTML of the table.
{% if editmode %}
{{ pimcore_table("productProperties", {
"width": 700,
"height": 400,
"defaults": {
"cols": 2,
"rows": 3,
"data": [
["Attribute name", "Value"],
["Color", "Black"],
["Size", "Large"],
["Availability", "Out of stock"]
]
}
})}}
{% else %}
{% set data = pimcore_table("productProperties").getData() %}
{# returns the data as an array #}
{# do something with it ;-) #}
{% endif %}
The output from getData():
array(4) {
[0] => array(3) {
[0] => string(14) "Attribute name"
[1] => string(5) "Value"
[2] => string(18) " Additional column"
}
[1] => array(3) {
[0] => string(5) "Color"
[1] => string(5) "Black"
[2] => string(1) " "
}
[2] => array(3) {
[0] => string(4) "Size"
[1] => string(5) "Large"
[2] => string(1) " "
}
[3] => array(3) {
[0] => string(12) "Availability"
[1] => string(12) "Out of stock"
[2] => string(1) " "
}
}
| Processing the Data | [
-0.13395792245864868,
-0.3079489767551422,
-0.2960204482078552,
0.20474489033222198,
0.08042869716882706,
-0.3031640350818634,
0.058602474629879,
0.393832802772522,
-0.3088423013687134,
0.23656579852104187,
-0.07236722111701965,
0.474665105342865,
0.23621757328510284,
0.5704746842384338,
... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Textarea#textarea-editable | Textarea Editable | Textarea Editable | [
0.19578641653060913,
-0.2767602801322937,
-0.3442327082157135,
0.012610766105353832,
0.19036360085010529,
-0.13329870998859406,
0.36960962414741516,
-0.05782294273376465,
-0.19306343793869019,
0.3065034747123718,
-0.5180398225784302,
-0.0274982750415802,
0.1670021265745163,
0.0967521220445... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Textarea#general | General
The textarea editable is very similar to the Input editable, the only difference is multi-line support. | General | [
0.17877894639968872,
-0.39436280727386475,
-0.30005332827568054,
-0.17843912541866302,
0.03051668219268322,
-0.1278369277715683,
0.3572501838207245,
-0.0673757866024971,
-0.30075493454933167,
0.13496190309524536,
-0.4854011535644531,
0.08281321823596954,
0.06743714213371277,
0.151463657617... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Textarea#configuration | Configuration
Name
Type
Description
height
integer
Height of the textarea in pixel
htmlspecialchars
boolean
Set to false to get the raw value without HTML special chars like & (default: true)
nl2br
boolean
Set to true to get also breaks in frontend
placeholder
string
A placeholder that is displayed when the field is empty
width
integer
Width of the textarea in pixel
class
string
A CSS class that is added to the surrounding container of this element in editmode
required
boolean
set to true to make field value required for publish
| Configuration | [
0.18390631675720215,
-0.4872930645942688,
-0.20455828309059143,
0.02379661053419113,
0.15654098987579346,
-0.1914074420928955,
0.3354768753051758,
0.10103660076856613,
-0.4025516211986542,
0.3122105300426483,
0.23855841159820557,
-0.0637584701180458,
0.4441508650779724,
0.3949320614337921,... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Textarea#methods | Methods
Name
Return
Description
getData()
array
Get the value of the textarea
isEmpty()
bool
Whether the editable is empty or not.
| Methods | [
0.2717539668083191,
-0.5549877285957336,
-0.3372655510902405,
0.06421815603971481,
0.03783731535077095,
-0.19014035165309906,
0.3034135103225708,
0.2753598093986511,
-0.20795772969722748,
0.2007201462984085,
-0.31423258781433105,
0.22544459998607635,
-0.009340979158878326,
0.07514311373233... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Textarea#example | Example
<p class="product-description">
{{ pimcore_textarea("product_description",{
"nl2br": true,
"height": 300,
"placeholder": "Product Description"
}) }}
</p>
In the editmode, you can see the textarea and the predefined placeholder.
| Example | [
-0.07052568346261978,
-0.4476725459098816,
-0.0982377752661705,
0.12167426198720932,
0.14194634556770325,
-0.45270487666130066,
0.3072354793548584,
-0.19137421250343323,
-0.5134321451187134,
0.08510392159223557,
0.09073520451784134,
0.2203519642353058,
0.3692234754562378,
0.196556732058525... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Video#video-editable | Video Editable | Video Editable | [
0.03585287556052208,
-0.27202171087265015,
-0.37438440322875977,
-0.08681059628725052,
0.3167421519756317,
-0.128585085272789,
0.04501575604081154,
0.17713189125061035,
-0.4798581302165985,
0.2911871075630188,
-0.23698069155216217,
0.2460169792175293,
-0.2531784772872925,
0.263715744018554... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Video#general | General
The video editable is a powerful editable to embed videos in the content.
Supported video sources are: local assets, YouTube, Vimeo and Dailymotion.
Local asset videos support the automatic generation and transcoding of videos using Video Thumbnails. | General | [
0.16099438071250916,
-0.4225018322467804,
-0.27077892422676086,
-0.3077700138092041,
0.266219824552536,
-0.030757857486605644,
0.03164466470479965,
0.04941117763519287,
-0.306782603263855,
0.17151105403900146,
-0.03461451828479767,
0.316138356924057,
-0.1915345937013626,
0.2081550359725952... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Video#configuration | Configuration
Name
Type
Description
allowedTypes
array
You can limit the available types for this editable by passing the allowed types explicitly. If this option is not used, all types are available.
attributes
array
Additional attributes for the generated <video> tag - only for type asset
editmodeImagePreview
bool
(default: false) Set to true to display only an image and not the video player in editmode, this can be necessary if you have many videos on one page (performance)
height
integer/string
(default: 300) Height of the video in pixel or in percent
imagethumbnail
string
Name of the image-thumbnail, this thumbnail config is used to generate the preview image (poster image), if not specified Pimcore tries to get the information out of the video thumbnail. see also: Video Thumbnails
removeAttributes
array
You can remove standard attributes using this configuration, e.g. "removeAttributes" => ["controls","poster"]
thumbnail
string
Name of the video-thumbnail (required when using automatic-transcoding of videos) see: Video Thumbnails
width
integer/string
(default: "100%") Width of the video in pixel or in percent
youtube
array
Parameters for youtube integration. Possible parameters: https://developers.google.com/youtube/player_parameters - only for type youtube
class
string
A CSS class that is added to the surrounding container of this element in editmode
required
boolean
(default: false) set to true to make field value required for publish
| Configuration | [
0.07070174068212509,
-0.3734697699546814,
-0.1820659190416336,
-0.27508947253227234,
0.39915353059768677,
-0.2422097772359848,
0.16678465902805328,
0.12213343381881714,
-0.4772867262363434,
0.17423617839813232,
-0.1857382357120514,
0.3020997941493988,
-0.061800308525562286,
0.1150702834129... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Video#methods | Methods
Name
Arguments
Return
Description
getImageThumbnail($name)
(string/array) $name
string, absolute path to the thumbnail
Get a specific image thumbnail of the video, or a thumbnail of the poster image (if assigned)
getPosterAsset()
Pimcore\Model\Asset
Returns the assigned poster image asset
getThumbnail()
(string/array) $name
array, absolute paths to the different video thumbnails
Get a specific video-thumbnail of the video
getVideoAsset()
-
asset
Returns the video asset object if assigned, otherwise null
getVideoType()
-
string, type of the video (asset,youtube,vimeo,url)
This is to check which video type is assigned
getTitle()
-
string
Title of the video
getDescription()
-
string
Description of the video
getData()
-
array
All the available data on this editable
isEmpty()
-
bool
Whether the editable is empty or not.
Output returned by getPosterAsset:
[status] => finished
[formats] => Array
(
[mp4] => /var/tmp/video_3414__example.mp4
)
| Methods | [
-0.02933936007320881,
-0.2826910614967346,
-0.2641175091266632,
0.16143956780433655,
0.13635322451591492,
-0.23185430467128754,
0.13986393809318542,
0.4638510048389435,
-0.3696073293685913,
-0.0008423919789493084,
-0.4350584149360657,
0.40924790501594543,
-0.005491685122251511,
0.008401667... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Video#examples | Examples | Examples | [
0.1105974018573761,
-0.41019901633262634,
-0.28510186076164246,
0.1324809491634369,
-0.13995729386806488,
-0.14305032789707184,
0.3125857710838318,
0.14037898182868958,
-0.0417528860270977,
0.3020334243774414,
0.41210994124412537,
0.22653697431087494,
-0.10223178565502167,
-0.0599273890256... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Video#basic-usage---a-local-asset | Basic Usage - a Local Asset
To create a container for local video files you can just use the $this->video helper without any options.
<section id="campaign_video">
{{ pimcore_video('campaignVideo', {
width: 700,
height: 400
}) }}
</section>
In the editmode, there is now a container available where you can assign an asset path and a video poster.
| Basic Usage - a Local Asset | [
-0.4805133640766144,
-0.03029528260231018,
-0.11900094896554947,
-0.09474507719278336,
0.12196499854326248,
-0.39940738677978516,
0.24540384113788605,
0.31336987018585205,
-0.3654543459415436,
0.31254473328590393,
0.09834437072277069,
0.19097653031349182,
-0.102213054895401,
0.271049350500... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Video#youtube,-vimeo-&-dailymotion | YouTube, Vimeo & Dailymotion
You can use videos from external services, as well (at the moment, YouTube, Vimeo and Dailymotion) but with limited functionalities.
In the video edit dialog, change the type to youtube and fill the ID input with a video identifier or the video URL.
(in that case you can easily find it in the url). Youtube playlists are supported as well - you can identify them by the prefix PL in the ID.
Have a look at the frontend preview:
In the configuration, you could also specify additional options for external services.
<section id="campaign_video">
{{ pimcore_video('campaignVideo', {
width: 700,
height: 400,
youtube: {
autoplay: true,
modestbranding: true
},
vimeo: {
autoplay: true,
loop: true
}
})
}}
</section>
It is possible to limit the available types for this editable. The selection can be restricted via the "allowedTypes" parameter.
<section id="campaign_video">
{{ pimcore_video('campaignVideo', {
allowedTypes: ['asset', 'youtube']
})
}}
</section>
| YouTube, Vimeo & Dailymotion | [
-0.20254047214984894,
-0.22256974875926971,
-0.16923943161964417,
-0.32730036973953247,
0.24704675376415253,
-0.26937463879585266,
-0.06141820177435875,
0.039488375186920166,
-0.12040847539901733,
-0.0022660226095467806,
-0.03631102293729782,
0.28071022033691406,
-0.08341017365455627,
0.42... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Video#html5-with-automatic-video-transcoding-(using-video.js) | HTML5 with Automatic Video Transcoding (using video.js)
<!DOCTYPE HTML>
<html>
<head>
<link href="http://vjs.zencdn.net/5.4.4/video-js.css" rel="stylesheet">
</head>
<body>
{{ pimcore_video('myVideo', {
thumbnail: 'example',
width: 400,
height: 300,
attributes: {
'class': 'video-js custom-class',
'preload': 'auto',
'controls': '',
'data-custom-attr': 'my-test'
}
})
}}
<script src="http://vjs.zencdn.net/5.4.4/video.js"></script>
</body>
</html>
Read more about Video Thumbnails. | HTML5 with Automatic Video Transcoding (using video.js) | [
-0.1846834272146225,
-0.3690839111804962,
-0.1838625818490982,
-0.19289103150367737,
0.29912155866622925,
-0.4366815984249115,
0.09392718970775604,
0.18785472214221954,
-0.5474515557289124,
0.14727945625782013,
0.019067715853452682,
0.09546229243278503,
0.1260761171579361,
0.45236313343048... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/WYSIWYG#wysiwyg-editable | WYSIWYG Editable | WYSIWYG Editable | [
0.2657470703125,
-0.37800875306129456,
-0.27342933416366577,
-0.12011254578828812,
0.39847660064697266,
0.15668539702892303,
0.2258884608745575,
0.08405490219593048,
-0.08420317620038986,
0.41933223605155945,
-0.25198155641555786,
0.2852174937725067,
-0.1804715245962143,
0.1084300205111503... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/WYSIWYG#general | General
Similar to Textarea and Input you can use the WYSIWYG editable in the templates to provide rich-text editing. TinyMce is installed by default in our demo. Another editor can be installed via the wysiwyg-events you find in events.js | General | [
-0.0020305023062974215,
-0.46103331446647644,
-0.28692948818206787,
-0.2181658148765564,
0.11569798737764359,
0.012608986347913742,
0.15703681111335754,
0.2674257457256317,
-0.15328016877174377,
0.09964907914400101,
-0.02696860022842884,
0.25294896960258484,
0.028563790023326874,
0.1921171... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/WYSIWYG#add-a-custom-editor | Add a Custom Editor
Make sure that you add the Editor to pimcore.wysiwyg.editors. This array can be used to have different editors for different use cases(documents, objects ...):
if(!parent.pimcore.wysiwyg) {
parent.pimcore.wysiwyg = {};
parent.pimcore.wysiwyg.editors = [];
}
parent.pimcore.wysiwyg.editors.push('Custom_Ediotor');
The Editor als needs to dispatch the pimcore.events.changeWysiwyg to set the value from the WYSIWYG-Field in the core.
document.dispatchEvent(new CustomEvent(pimcore.events.changeWysiwyg, {
detail: {
e: eChange,
data: tinymce.activeEditor.contentAreaContainer.innerHTML, //text of the editor-field
context: e.detail.context //the context in which the editor is registered (object, document ...)
}
}));
Please use the events from event.js to bind your Editor on the field and to configure it.
For more details please take a look at the TinymceBundle. | Add a Custom Editor | [
-0.024385137483477592,
-0.24475470185279846,
-0.07198396325111389,
-0.19111166894435883,
0.039983779191970825,
-0.11170382797718048,
0.3116244375705719,
0.14235423505306244,
-0.3149743676185608,
0.20988522469997406,
-0.03653939440846443,
0.7326677441596985,
-0.01478208601474762,
0.14638848... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/WYSIWYG#extending-symfony-html-sanitizer-configuration | Extending symfony HTML sanitizer configuration
Wysiwyg editables are using symfony HTML sanitizer in order to clean the HTML content from unwanted tags and parameters. Default configuration is defined like this:
framework:
html_sanitizer:
sanitizers:
pimcore.wysiwyg_sanitizer:
allow_elements:
p: ['class', 'style']
strong: 'class'
em: 'class'
h1: 'class'
a: ['class', 'href', 'target', 'title', 'rel']
table: ['class', 'style', 'cellspacing', 'cellpadding', 'border', 'width', 'height']
colgroup: 'class'
col: ['class', 'style']
tbody: 'class'
tr: 'class'
td: 'class'
ul: ['class', 'style']
li: ['class', 'style']
ol: ['class', 'style']
If you want to adapt this configuration please have a look at the symfony documentation. Add your custom configuration to you project, e.g. to config/packages/html_sanitizer.yaml
Note: When using API to set WYSIWYG data, please pass encoded characters for html entities e.g. <,>, & etc.
The data is encoded by the sanitizer before persisting into db and the same encoded data will be returned by the API.
| Extending symfony HTML sanitizer configuration | [
0.20409275591373444,
-0.10719619691371918,
-0.08952035754919052,
-0.25279998779296875,
0.3541949391365051,
-0.11391390115022659,
0.36473703384399414,
0.39528220891952515,
-0.06342899054288864,
0.12519796192646027,
-0.24131298065185547,
0.3308365046977997,
-0.0738798975944519,
0.03434094414... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Scheduled_Block#scheduled-block-editable | Scheduled Block Editable | Scheduled Block Editable | [
0.03330143541097641,
-0.34182092547416687,
-0.3118216395378113,
-0.10578913241624832,
0.2082216441631317,
-0.12457320094108582,
0.11279922723770142,
-0.1690799742937088,
0.07100114971399307,
0.4803398549556732,
-0.19303257763385773,
0.2141266018152237,
-0.4275434613227844,
0.12631215155124... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Scheduled_Block#general | General
The scheduled block element allows to manage scheduled content within an editable.
Basically the scheduled block is very similar to the standard block editable.
You can configure one or multiple sub editables that are repeated multiple times as block items.
The difference is, that within the scheduled block each block item has a specific timestamp and in
the frontend only one block item - the one with the corresponding timestamp - is displayed at a time
(not all within a loop).
In editmode, additional block items can be added and their timestamp can be configured. | General | [
0.06530090421438217,
-0.5463882088661194,
-0.20368555188179016,
-0.14572280645370483,
-0.044199272990226746,
0.13554880023002625,
0.40518680214881897,
-0.04518850892782211,
-0.09603790938854218,
0.19611208140850067,
-0.06681498140096664,
0.29056301712989807,
-0.28238680958747864,
0.2076548... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Scheduled_Block#configuration | Configuration
Name
Type
Description
class
string
A CSS class that is added to the surrounding container of this element in editmode
| Configuration | [
0.15076220035552979,
-0.4046672582626343,
-0.20080453157424927,
-0.07318905740976334,
0.13143908977508545,
0.06585820764303207,
0.3277283310890198,
0.010881065391004086,
-0.45877522230148315,
0.05046839267015457,
0.07338150590658188,
-0.11214958131313324,
0.10570380091667175,
0.20936891436... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Scheduled_Block#methods | Methods
Name
Return
Description
isEmpty()
bool
Whether the editable is empty or not.
getCount()
int
Get the total amount of iterations.
getCurrent()
int
Get the current index while looping.
getElements()
array
Return a array for every loop to access the defined children.
| Methods | [
0.3056178689002991,
-0.45360618829727173,
-0.40987858176231384,
0.2598734200000763,
0.10694708675146103,
0.0062672970816493034,
0.12379401922225952,
0.12184441834688187,
-0.022984758019447327,
0.15843752026557922,
-0.4578399360179901,
0.37086939811706543,
-0.09614534676074982,
0.0523382686... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Scheduled_Block#the-block-controls | The Block Controls
Control
Operation
Select a day for the block item timestamp.
Select the time for the block item with the slider.
Add new block item.
List of all block items with jump to function.
Delete all block items or all block items of the past.
| The Block Controls | [
-0.023887809365987778,
-0.1158631443977356,
-0.18242579698562622,
-0.11890538781881332,
-0.2759280204772949,
0.15716752409934998,
0.4222043752670288,
0.09886171668767929,
0.1673504263162613,
0.3565126657485962,
0.12269076704978943,
0.22791510820388794,
-0.20624378323554993,
0.1495392024517... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables/Scheduled_Block#basic-usage | Basic Usage
{% for i in pimcore_scheduledblock('block').iterator %}
<h2>{{ pimcore_input('blockinput') }}</h2>
{{ pimcore_image('myimage') }}
{% endfor %}
The result in editmode should looks like to following:
And in the frontend of the application:
In document preview, Pimcore provides a time slider to get the preview for a certain time as soon as
the document has at least one scheduled block editable.
For details on how to create custom functionality using the time slider see
Preview Scheduled Content. | Basic Usage | [
-0.235721156001091,
-0.415989488363266,
-0.17479535937309265,
-0.061962638050317764,
-0.09671501815319061,
-0.12985852360725403,
0.3784748911857605,
0.10800106823444366,
-0.11812276393175125,
0.2539362609386444,
-0.07429727166891098,
0.43136176466941833,
-0.14301075041294098,
-0.1245496794... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables#editables | Editables
The editables are placeholders in the templates, which are displayed as input widgets in the admin interface (so called editmode) and output the content in frontend mode.
They are the essential part of managing content in documents. | Editables | [
0.3688274919986725,
-0.32068780064582825,
-0.134135901927948,
-0.32060426473617554,
0.15786434710025787,
0.3027689754962921,
0.15974712371826172,
0.07531329244375229,
-0.23289749026298523,
0.027189278975129128,
-0.24153827130794525,
0.3500298261642456,
0.12742896378040314,
-0.0446187816560... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables#example-usage | Example Usage
The following code makes the <h1> headline editable in a document:
<h1>{{ pimcore_input("headline") }}</h1>
In some cases, especially with areablocks, editables could throw exceptions. Since Pimcore internally uses the __toString method to render
the editables, Pimcore can't throw exceptions there. Therefore Pimcore catches the exception, and puts it out as string if DEBUG Mode is enabled.
To prevent that and to have Pimcore throw the Exception, you can call editables like:
<h1>{{ pimcore_input("headline").render()|raw }}</h1>
Pimcore automatically displays an input widget in the edit mode and renders the content when accessing the document via the frontend. | Example Usage | [
-0.1419285386800766,
-0.4640660583972931,
-0.06061079353094101,
-0.14920784533023834,
0.2562728524208069,
-0.24101783335208893,
0.2828627824783325,
0.15784098207950592,
-0.40598613023757935,
0.30325499176979065,
-0.17897962033748627,
0.7752271294593811,
0.18896551430225372,
0.1190411597490... |
https://pimcore.com/docs/platform//Pimcore/Documents/Editables#list-of-editables | List of Editables
Name
Description
Areablock
Areablock is the content construction kit which allows you to insert predefined mini applications / content blocks called bricks into an areablock..
Area
Area allows you to use area bricks of a certain type (just like the Areablock).
Block
Block is a loop component which can contain other editables.
Checkbox
Checkbox / bool implementation for documents.
Date
Datepicker, showing the date in a specified format.
Relation
Provides possibility to create a reference to any other element in Pimcore (document, asset, object).
Relations (Many-To-Many Relation)
Provides possibility to edit multiple references to other elements in Pimcore (documents, assets, objects).
Image
A place where you can assign an image (from the assets module).
Input
A single-line text-input.
Link
An editable link component.
Multiselect
Multiselect implementation for documents.
Numeric
The numeric editable is like the input editable but with special options for numbers (like minimum value, decimal precision...).
PDF
This editable allows you to embed asset documents (pdf, doc, xls, ...) into documents (like video, image, ...).
Renderlet
The renderlet is a special container which is able to handle every object in Pimcore (Documents, Assets, Objects).
Select
Select box as an editable.
Snippet (embed)
Use the snippet editable to embed a reusable document, for example to create teasers, boxes, etc.
Table
This editable allows you to add a fully editable table.
Textarea
Textarea implementation for documents.
Video
Use the Video editable to insert asset movies in pages content.
WYSIWYG
WYSIWYG editor.
Scheduled Block
Scheduled Blocks allow to schedule content for certain timestamps
| List of Editables | [
0.11697465181350708,
-0.2729994058609009,
-0.21738474071025848,
-0.1683882474899292,
0.08671161532402039,
0.2491840124130249,
0.19261270761489868,
0.22032521665096283,
-0.26220640540122986,
0.2229548990726471,
-0.3950901925563812,
0.7568278908729553,
-0.10213673114776611,
0.283230841159820... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#navigation | Navigation | Navigation | [
0.13551443815231323,
-0.4215073883533478,
-0.3692023456096649,
0.015911893919110298,
0.031194379553198814,
-0.2740229368209839,
-0.06985576450824738,
0.07804367691278458,
-0.059447646141052246,
0.1496484875679016,
-0.23684431612491608,
0.09633130580186844,
0.010497243143618107,
-0.06523252... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#basics | Basics
Pimcore comes with a standard navigation implementation in the form of a Twig extension.
It builds a navigation container based on the existing document structure. The process of rendering is divided into 2 steps:
Build the navigation: {% set nav = pimcore_build_nav({active: activeDocument, root: navigationRootDocument}) %}
Render the navigation: pimcore_render_nav(nav) or pimcore_nav_renderer('menu').render(nav)
The building step does not necessarily need to happen in the view script. In fact the view helper just forwards the
build() call to the Pimcore\Navigation\Builder service. You can also build the navigation in your controller
or a service and pass the navigation object to the view.
Only documents are included in this structure, Folders are ignored, regardless of their navigation properties.
{# get root node if there is no document defined (for pages which are routed directly through static route) #}
{% if not document is defined or not document %}
{% set document = pimcore_document(1) %}
{% endif %}
{# get the document which should be used to start in navigation | default home #}
{% set navStartNode = document.getProperty('navigationRoot') %}
{% if not navStartNode is instanceof('\\Pimcore\\Model\\Document\\Page') %}
{% set navStartNode = pimcore_document(1) %}
{% endif %}
{% set mainNavigation = pimcore_build_nav({
active: document,
root: navStartNode
}) %}
{# later you can render the navigation #}
{{ pimcore_render_nav(mainNavigation) }}
Having set up the navigation container as shown above, you can easily use it to render a navigation tree, menus, or breadcrumbs. | Basics | [
-0.19896811246871948,
-0.12248553335666656,
-0.11592498421669006,
-0.09290067106485367,
-0.06802584230899811,
-0.33473607897758484,
-0.04545897617936134,
0.23550111055374146,
-0.3303695321083069,
0.04161728546023369,
-0.13386227190494537,
0.5285871624946594,
-0.02625122293829918,
0.1927371... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#meta-navigation---only-the-1st-level | Meta Navigation - Only the 1st Level
{{ pimcore_nav_renderer('menu').renderMenu(mainNavigation,{
maxDepth: 1,
ulClass: 'nav navbar-nav'
}) | raw }}
{#alternatively, you can use the render function to use the given renderer and render method#}
<div class="my-menu">
{# the menu() shortcut is not available in twig #}
{{ pimcore_render_nav(mainNavigation, 'menu', 'renderMenu', {
maxDepth: 1,
ulClass: 'nav navbar-nav'
}) }}
</div>
| Meta Navigation - Only the 1st Level | [
-0.011053633876144886,
-0.4950941503047943,
-0.11740967631340027,
-0.12284562736749649,
0.20561756193637848,
-0.1341789811849594,
-0.004000767134130001,
0.30366936326026917,
-0.4366064965724945,
0.11454205960035324,
-0.2931235730648041,
0.6142448782920837,
0.14497672021389008,
0.2448560893... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#meta-navigation---multilevel | Meta Navigation - Multilevel
<div class="my-menu">
{# you can use array for ulClass to provide depth level classes #}
{{ pimcore_render_nav(mainNavigation, 'menu', 'renderMenu', {
maxDepth: 2,
ulClass: {
0: 'nav navbar-nav',
1: 'nav navbar-nav-second',
2: 'nav navbar-nav-third'
}
}) }}
{# alternatively, you can use 'default' key to apply class on all depth levels #}
{{ pimcore_render_nav(mainNavigation, 'menu', 'renderMenu', {
maxDepth: 2,
ulClass: {
default: 'nav navbar-nav'
}
}) }}
</div>
| Meta Navigation - Multilevel | [
-0.13812808692455292,
-0.5399094820022583,
-0.162266343832016,
0.06917769461870193,
0.2635439932346344,
-0.2531186640262604,
0.08939168602228165,
0.08828981220722198,
-0.32229891419410706,
0.14266958832740784,
-0.1347816288471222,
0.526836633682251,
0.04976051673293114,
0.3938319683074951,... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#breadcrumbs | Breadcrumbs
<div class="my-breadcrumbs">
<a href="/">{{ 'Home'|trans }}</a> >
{{ pimcore_render_nav(mainNavigation, 'breadcrumbs') }}
</div>
| Breadcrumbs | [
-0.2166469395160675,
-0.3582209646701813,
-0.23129624128341675,
-0.11635351926088333,
0.15306465327739716,
-0.38715142011642456,
0.0876716747879982,
0.13175053894519806,
-0.2390209585428238,
0.011947941035032272,
-0.14008918404579163,
0.3891419470310211,
0.16633503139019012,
0.124632261693... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#sidebar-navigation | Sidebar Navigation
<div class="my-sidebar-menu">
{{ pimcore_nav_renderer('menu').renderMenu(mainNavigation) }}
</div>
| Sidebar Navigation | [
-0.30966508388519287,
-0.3354896306991577,
-0.23922602832317352,
-0.1364912986755371,
0.06282597035169601,
-0.0775718167424202,
0.11751678586006165,
0.2098689079284668,
-0.2038278728723526,
0.09056366980075836,
-0.20251038670539856,
0.38025373220443726,
0.3053303360939026,
0.01343463733792... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#sidebar-navigation-with-a-different-html-prefix | Sidebar Navigation with a Different HTML Prefix
<div class="my-sidebar-menu">
{% set sideNav = pimcore_build_nav({active: document, root: navStartNode, htmlMenuPrefix: 'my-nav-'}) %}
{{ pimcore_render_nav(sideNav, 'menu', 'renderMenu', {
ulClass: 'nav my-sidenav',
expandSiblingNodesOfActiveBranch: true
}) }}
</div>
The renderMenu() method renders the menu to the deepest available level.
Levels trees which are not within the active tree, and levels below the latest active page must be hidden using CSS.
The example CSS below shows how to do that (includes 3 Levels):
#navigation ul li ul {
display:none;
}
#navigation ul li.active ul {
display:block;
}
#navigation ul li.active ul li ul {
display:none;
}
#navigation ul li.active ul li.active ul {
display:block;
}
#navigation ul li.active ul li.active ul li ul {
display:none;
}
#navigation ul li.active ul li.active ul li.active ul{
display:block;
}
| Sidebar Navigation with a Different HTML Prefix | [
-0.22250089049339294,
-0.47300446033477783,
-0.12277525663375854,
0.10534827411174774,
0.19437085092067719,
-0.25077545642852783,
-0.006630890071392059,
0.39782825112342834,
-0.11349176615476608,
0.046381108462810516,
-0.466024249792099,
0.3060990273952484,
0.21769946813583374,
0.228210166... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#setting-a-document's-navigation-property | Setting a Document's Navigation Property
Pages and links have Navigation Settings in their system properties as shown in the screen above.
These navigation settings include the following properties:
Name: Document's name used in the navigation (label).
Title: Document's title used in the navigation - the HTML Attribute title.
Target: Link target (_blank, _self, _top, _parent)
Exclude from Navigation: Property to quickly exclude a page from the navigation.
In your view template you can use:
{% do document.getProperty('navigation_exclude') %}
Class: HTML class of the navigation element
Anchor: Anchor appended to the document's URL
Parameters: Parameters appended to the document's URL
Relation: Only available in custom navigation script. Supposedly the HTML rel attribute to open the link in a sort of Lightbox / Clearbox
Accesskey: Only available in custom navigation script
Tab-Index: Only available in custom navigation script
| Setting a Document's Navigation Property | [
0.13951075077056885,
-0.29413482546806335,
-0.08803413808345795,
-0.3468303680419922,
-0.006944672204554081,
-0.1735095977783203,
-0.07989160716533661,
0.29302260279655457,
0.1204502135515213,
0.13351716101169586,
-0.22819635272026062,
0.3404175043106079,
0.045458029955625534,
0.0410557314... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#individual-(partial)-navigation-view-script | Individual (Partial) Navigation View Script
If the standard HTML output of the render() method is not suitable for a project, there is the possibility to provide a custom script for the menu HTML.
For example, inside your view:
{# \Pimcore\Navigation\Renderer\Menu #}
{% set menuRenderer = pimcore_nav_renderer('menu') %}
{# either use the renderPartial method to use a partial once #}
{{ menuRenderer.renderPartial(mainNavigation, 'includes/navigation.html.twig') | raw }}
{# or set the partial on the renderer (will be valid for all subsequent render calls) #}
{% do menuRenderer.setPartial('includes/navigation.html.twig') %}
{{ menuRenderer.render(mainNavigation) | raw }}
templates/includes/navigation.html.twig
{% for page in pages %}
<div class="my-menu-element">
{{ pimcore_nav_renderer('menu').htmlify(page) | raw }}
</div>
{% endfor %}
| Individual (Partial) Navigation View Script | [
-0.3160509765148163,
-0.09669236093759537,
-0.15919870138168335,
-0.22855104506015778,
0.06775355339050293,
-0.2574947774410248,
-0.03866902366280556,
0.41806891560554504,
-0.11703651398420334,
0.07256563752889633,
-0.2666080594062805,
0.5793089866638184,
0.03352442383766174,
0.30241540074... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#using-the-navigation-helper-with-sites. | Using the Navigation Helper with Sites.
For example:
{% set navStartNode = document.getProperty('navigation_root') %}
{% if not navStartNode is instanceof('\\Pimcore\\Model\\Document\\Page') %}
{% if pimcore_site_is_request() %}
{% set site = pimcore_site_current() %}
{% set navStartNode = site.getRootDocument() %}
{% else %}
{% set navStartNode = pimcore_document(1) %}
{% endif %}
{% endif %}
{% set navigation = pimcore_build_nav({active: document, root: navStartNode}) %}
{{ pimcore_render_nav(navigation, 'menu', 'renderMenu', {
maxDepth: 1,
ulClass: {
'default': 'nav navbar-nav'
}
}) }}
| Using the Navigation Helper with Sites. | [
-0.3779705762863159,
-0.31921979784965515,
-0.17448127269744873,
-0.118169866502285,
0.09529457241296768,
-0.30616962909698486,
0.016795339062809944,
0.30007418990135193,
-0.2212192714214325,
-0.012040837667882442,
-0.016762739047408104,
0.3311699330806732,
0.1318729668855667,
0.3053574264... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#using-partials-generating-a-customized-navigation | Using Partials Generating a Customized Navigation
For example, generate bootstrap 4.0 style navigation:
{% set navStartNode = document.getProperty('navigation_root') %}
{% if not navStartNode is instanceof('\\Pimcore\\Model\\Document\\Page') %}
{% if pimcore_site_is_request() %}
{% set site = pimcore_site_current() %}
{% set navStartNode = site.getRootDocument() %}
{% else %}
{% set navStartNode = pimcore_document(1) %}
{% endif %}
{% endif %}
{% set mainNavigation = pimcore_build_nav({active: document, root: navStartNode}) %}
{% set menuRenderer = pimcore_nav_renderer('menu') %}
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
{% for page in mainNavigation %}
{# here need to manually check for ACL conditions #}
{% if page.isVisible() and menuRenderer.accept(page) %}
{% set hasChildren = page.hasPages() %}
{% if not hasChildren %}
<li class="nav-item">
<a class="nav-link" href="{{ page.getHref() }}">{{ page.getLabel() }}</a>
</li>
{% else %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="{{ page.getHref() }}" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{ page.getLabel() }}</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
{% for child in page.getPages() %}
{% if child.isVisible() and menuRenderer.accept(child) %}
<a class="dropdown-item" href="{{ child.getHref() }}">{{ child.getLabel() }}</a>
{% endif %}
{% endfor %}
</div>
</li>
{% endif %}
{% endif %}
{% endfor %}
</ul>
</div>
</nav>
| Using Partials Generating a Customized Navigation | [
-0.19718533754348755,
-0.22370478510856628,
-0.24084188044071198,
-0.007922087796032429,
0.18805719912052155,
-0.3266834616661072,
0.16614682972431183,
0.38844597339630127,
-0.1462748646736145,
0.07908566296100616,
-0.35049501061439514,
0.132164865732193,
0.08133172988891602,
0.29658892750... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#adding-custom-items-to-the-navigation | Adding Custom Items to the Navigation
In the following example we're adding news items (objects) to the navigation using Twig Extension.
<?php
namespace App\Twig\Extension;
use App\Website\LinkGenerator\NewsLinkGenerator;
use Pimcore\Model\Document;
use Pimcore\Navigation\Container;
use Pimcore\Twig\Extension\Templating\Navigation;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
class NavigationExtension extends AbstractExtension
{
protected Navigation $navigationHelper;
protected NewsLinkGenerator $newsLinkGenerator;
public function __construct(Navigation $navigationHelper, NewsLinkGenerator $newsLinkGenerator)
{
$this->navigationHelper = $navigationHelper;
$this->$newsLinkGenerator = $newsLinkGenerator;
}
/**
* @return TwigFunction[]
*/
public function getFunctions(): array
{
return [
new TwigFunction('app_navigation_news_links', [$this, 'getDataLinks'])
];
}
/**
* @throws \Exception
*/
public function getNewsLinks(Document $document, Document $startNode): Container
{
$navigation = $this->navigationHelper->build([
'active' => $document,
'root' => $startNode,
'pageCallback' => function($page, $document) {
/** @var \Pimcore\Model\Document $document */
/** @var \Pimcore\Navigation\Page\Document $page */
if($document->getProperty("templateType") == "news") {
$list = new \Pimcore\Model\DataObject\News\Listing;
$list->load();
foreach($list as $news) {
$detailLink = $this->newsLinkGenerator->generate($news, ['document' => $document]);
$uri = new \Pimcore\Navigation\Page\Document([
"label" => $news->getTitle(),
"id" => "object-" . $news->getId(),
"uri" => $detailLink,
]);
$page->addPage($uri);
}
}
}
]);
return $navigation;
}
}
{% set mainNav = pimcore_build_nav({
active: document,
root: mainNavStartNode,
}) %}
{% set mainNavigation = app_navigation_news_links(document, navStartNode) %}
<div class="my-navigation">
{{ pimcore_render_nav(navigation, 'menu', 'renderMenu', {
expandSiblingNodesOfActiveBranch: true,
ulClass: {
default: 'nav my-sidenav'
}
}) }}
</div>
| Adding Custom Items to the Navigation | [
0.05885385721921921,
-0.08425728976726532,
-0.13944141566753387,
0.3224524259567261,
0.008823447860777378,
-0.20061661303043365,
-0.20670877397060394,
0.22010599076747894,
-0.3840646743774414,
0.08137065917253494,
-0.207283154129982,
0.4757114350795746,
0.07174745947122574,
-0.247926518321... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#caching--high-performance-navigation | Caching / High-Performance Navigation
The navigation tree / container (\Pimcore\Navigation\Container) is automatically cached by pimcore and improves
significantly the performance of the navigation.
To benefit from the cache it's absolutely necessary to don't use Pimcore\Model\Document objects directly in the
navigation templates / partial scripts, because this would result in loading all the documents again in the navigation and
bypasses the caching mechanism of the navigation container.
But sometimes it's necessary to get some properties or other data out of the documents in the navigation to build the navigation as it should be.
For that we've introduced a new parameter for the navigation extension, which acts as a callback and allows to map custom data onto the navigation page item.
<?php
namespace App\Twig\Extension;
use Pimcore\Model\Document;
use Pimcore\Navigation\Container;
use Pimcore\Twig\Extension\Templating\Navigation;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
class NavigationExtension extends AbstractExtension
{
protected Navigation $navigationHelper;
public function __construct(Navigation $navigationHelper)
{
$this->navigationHelper = $navigationHelper;
}
/**
* @return TwigFunction[]
*/
public function getFunctions(): array
{
return [
new TwigFunction('app_navigation_custom', [$this, 'getCustomNavigation'])
];
}
/**
* @throws \Exception
*/
public function getCustomNavigation(Document $document, Document $startNode): Container
{
$navigation = $this->navigationHelper->build([
'active' => $document,
'root' => $startNode,
'pageCallback' => function ($page, $document) {
$page->setCustomSetting("myCustomProperty", $document->getProperty("myCustomProperty"));
$page->setCustomSetting("subListClass", $document->getProperty("subListClass"));
$page->setCustomSetting("title", $document->getTitle());
$page->setCustomSetting("headline", $document->getEditable("headline")->getData());
}]
);
return $navigation;
}
}
{% set mainNavigation = app_navigation_custom(document, navStartNode) %}
{% set menuRenderer = pimcore_nav_renderer('menu') %}
{% do menuRenderer.setPartial("navigation/partials/navigation.html.twig") %}
{{ menuRenderer.render(mainNavigation) | raw }}
Later in the template of the navigation (navigation/partials/navigation.html.twig) you can use the mapped data directly on the page item object.
{% for page in pages %}
{% if page.isVisible() %}
{% set activeClass = page.getActive(true) ? 'active' : '' %}
<li class="{{ activeClass }}">
<a href="{{ page.getUri() }}" target="{{ page.getTarget() }}">{{ page.getLabel() }}</a>
<ul class="{{ page.getCustomSetting("subListClass") }}" role="menu">
{% include 'navigation/partials/partials/main.html.twig' with {pages: page.getPages()} %}
</ul>
</li>
{% endif %}
{% endfor %}
Using this method will dramatically improve the performance of your navigation. | Caching / High-Performance Navigation | [
-0.22623226046562195,
-0.06036720797419548,
-0.16985850036144257,
0.1058720201253891,
-0.007500058971345425,
-0.22221679985523224,
-0.17260822653770447,
0.3602690100669861,
-0.34155458211898804,
0.09031180292367935,
-0.2956075370311737,
0.2852696478366852,
0.25974956154823303,
-0.199320226... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#dynamic-key-for-the-navigation-cache | Dynamic Key for the Navigation Cache
Sometimes it's necessary to manually set the key for the navigation cache.
{% pimcore_build_nav({active: document, root: navStartNode, cache: 'yourindividualkey'}) %}
| Dynamic Key for the Navigation Cache | [
-0.2588590383529663,
-0.21986544132232666,
-0.13208292424678802,
-0.2129509598016739,
0.2001497745513916,
-0.2649257183074951,
-0.01608499139547348,
0.11817101389169693,
-0.22006915509700775,
0.01318470947444439,
-0.04185611009597778,
0.3500165045261383,
0.3060322105884552,
0.2935968637466... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#disabling-the-navigation-cache | Disabling the Navigation Cache
You can disable the navigation cache by setting the cache argument to false.
{% pimcore_build_nav({active: document, root: navStartNode, cache: false}) %}
| Disabling the Navigation Cache | [
-0.3457702100276947,
-0.13105598092079163,
-0.20809532701969147,
-0.23551467061042786,
0.23879745602607727,
-0.10441777855157852,
-0.04964487999677658,
0.32911333441734314,
-0.2911369204521179,
0.2002992033958435,
-0.05236859992146492,
0.3254425823688507,
0.3132290542125702,
0.163309186697... |
https://pimcore.com/docs/platform//Pimcore/Documents/Navigation#faq | FAQ
A document does not show up in the navigation. Why?
Please make sure that the documents and its parent documents are published and that the document it self as well as all it's parents have a navigation name set.
Neither the document itself nor one of it's parent documents may have activated Exclude From Navigation in their properties. (Document properties -> System properties)
Why is the navigation not appearing?
See the above question. If none of the documents have a navigation title set the render function will simply return nothing.
Why is the homepage not appearing in the navigation?
The homepage will not appear in the navigation by default. You can add the homepage (and any other page) manually:
{% do navigation.addPage({
order: -1,
uri: '/',
label: 'Home'|trans,
title: 'Home'|trans,
}) %}
If you retrieve the home document (which always has the ID 1) you can also retrieve its navigation properties so that they can be edited from the Pimcore admin interface like all the other documents.
{% set home = pimcore_document(1) %}
{#
order: put it in front of all the others
uri: path to homepage
label: visible label
title: tooltip text
active: active state (boolean)
#}
{% do navigation.addPage({
order: -1,
uri: '/',
label: home.getProperty('navigation_name'),
title: home.getProperty('navigation_title'),
active: document.id == home.id
}) %}
| FAQ | [
-0.01696879416704178,
-0.4212258756160736,
-0.06683658063411713,
-0.06214658170938492,
0.12454108148813248,
-0.021898139268159866,
0.02898535691201687,
0.1258312165737152,
-0.2808069586753845,
0.14849376678466797,
-0.08539874851703644,
0.4063906967639923,
0.4887992739677429,
-0.26620796322... |
https://pimcore.com/docs/platform//Pimcore/Documents/Predefined_Document_Types#predefined-document-types | Predefined Document-Types | Predefined Document-Types | [
0.016772499307990074,
-0.421983540058136,
-0.12476465851068497,
-0.10169954597949982,
0.12837621569633484,
-0.029426760971546173,
0.26728296279907227,
0.2346746027469635,
-0.06483414769172668,
-0.013959478586912155,
-0.1420932114124298,
0.17087015509605408,
-0.12992079555988312,
0.32094383... |
https://pimcore.com/docs/platform//Pimcore/Documents/Predefined_Document_Types#general | General
Pimcore provides the ability to define preconfigurations for documents, which makes it easier for editors to work with
many different controller/action and templates.
By using this feature the editors don't have to have any knowledge of which controller/action/template
should be used in a specific document because they can choose out of a predefined set of configurations with a friendly name. | General | [
-0.20714128017425537,
-0.5900293588638306,
0.002035801764577627,
-0.17733848094940186,
-0.18150000274181366,
-0.043033063411712646,
-0.006111508700996637,
0.33172494173049927,
-0.37220507860183716,
0.3235851228237152,
0.007751410827040672,
0.42428115010261536,
-0.053903091698884964,
0.2199... |
https://pimcore.com/docs/platform//Pimcore/Documents/Predefined_Document_Types#example | Example
To define document-type go to Settings > Document-Types.
Let's suppose that you've created controller, action and template for a books listing.
Reference to the action: App\Controller\BookController::listAction
Reference to the template: templates/book/list.html.twig
To add a new document-type which renders the book listing template, you have to click on the Add button first and then
fill out the newly created configuration row accordingly.
The type can be either a page, snippet, email.
printcontainer or printpage are only available if the PimcoreWebToPrintBundle is enabled and installed.
newsletter is only available if the PimcoreNewsletterBundle is enabled and installed.
After you have defined a type you can access it in the context menu or in the document settings: | Example | [
-0.1967557817697525,
-0.573980987071991,
0.020783530548214912,
0.18211519718170166,
0.04042668640613556,
0.026102744042873383,
-0.1556493043899536,
0.25054365396499634,
-0.17341947555541992,
0.041134025901556015,
-0.30241549015045166,
0.5642227530479431,
-0.1571706384420395,
0.183610945940... |
https://pimcore.com/docs/platform//Pimcore/Documents/Predefined_Document_Types#document-settings-preview | Document Settings Preview
| Document Settings Preview | [
-0.5169748067855835,
-0.5878041386604309,
-0.15707716345787048,
0.14627370238304138,
-0.10523345321416855,
0.26455119252204895,
0.02508983388543129,
0.31983402371406555,
-0.19954106211662292,
0.1423885077238083,
-0.08329003304243088,
-0.06405510753393173,
-0.12068630754947662,
0.1497193574... |
https://pimcore.com/docs/platform//Pimcore/Documents/Predefined_Document_Types#context-menu-preview | Context Menu Preview
| Context Menu Preview | [
-0.5883223414421082,
-0.5826910734176636,
-0.31165242195129395,
0.2868996560573578,
-0.25108152627944946,
0.04300837591290474,
0.28940966725349426,
0.2782353460788727,
-0.034545622766017914,
0.2323775440454483,
-0.2587452232837677,
-0.19343996047973633,
0.006260222289711237,
0.289507180452... |
https://pimcore.com/docs/platform//Pimcore/Documents/Working_with_PHP_API#working-with-documents-via-php-api | Working With Documents via PHP API
Pimcore provides the object orientated PHP API to work with Documents. | Working With Documents via PHP API | [
-0.2714613080024719,
0.10821908712387085,
-0.21608611941337585,
0.00837427843362093,
-0.23680993914604187,
-0.3536898195743561,
0.057370442897081375,
0.20850257575511932,
-0.290587455034256,
0.27361246943473816,
0.12004970014095306,
0.38974320888519287,
-0.13838347792625427,
0.269994705915... |
https://pimcore.com/docs/platform//Pimcore/Documents/Working_with_PHP_API#crud-operations | CRUD Operations | CRUD Operations | [
-0.09857362508773804,
-0.43491649627685547,
-0.2890259027481079,
0.09822020679712296,
-0.3227692246437073,
-0.4425601065158844,
0.08281990885734558,
-0.26832762360572815,
-0.043920524418354034,
0.465288907289505,
-0.0006307890289463103,
0.3369120955467224,
0.18654121458530426,
0.0821028351... |
https://pimcore.com/docs/platform//Pimcore/Documents/Working_with_PHP_API#create-a-new-document | Create a New Document
To create a new document, you need to specify two mandatory attributes:
An unique key
A parent ID - ID of the parent document (document, folder and every other type)
You can set also every other value available in documents structure (settings, properties, children etc.).
Type of the document (page, folder, link, email, snippet etc.) The complete list can be obtained using: \Pimcore\Model\Document::getTypes()
Every type has it's own model, for example: a link document could be created by new \Pimcore\Model\Document\Link.
The example below, shows how to create simple page document via the PHP API.
//CREATE A PAGE DOCUMENT
$page = new \Pimcore\Model\Document\Page();
$page->setKey('document8');
$page->setParentId(82); // id of a document or folder
// the optional parameter allows you to provide additional info
// currently supported:
// * versionNote: note added to the version (see version tab)
$page->save(["versionNote" => "my new version"]);
Now you can refresh the parent node of the newly created document in the admin interface (ID 82 in this case) and you'll
see the newly created document.
| Create a New Document | [
-0.3249668776988983,
-0.18412305414676666,
-0.07543588429689407,
0.041907116770744324,
-0.21753574907779694,
-0.1603316068649292,
-0.08067865669727325,
0.12288199365139008,
-0.2212691754102707,
0.17784619331359863,
-0.02308753691613674,
0.40354666113853455,
0.025107545778155327,
0.10671355... |
https://pimcore.com/docs/platform//Pimcore/Documents/Working_with_PHP_API#edit-an-existing-document | Edit an Existing Document
If you'd like to get a document you can use the getById() or getByPath() method from the \Pimcore\Model\Document class.
Find below, the list of available methods for loading documents.
Reference
Arguments
\Pimcore\Model\Document::getById
int $id
\Pimcore\Model\Document::getByPath
string $path
The following code presents how to get the wysiwyg editable value of the document.
//LOAD A DOCUMENT
$document = \Pimcore\Model\Document::getById(4);
if($document) {
//the logic when the type of the document is page
/** @var \Pimcore\Model\Document\Page $document */
/** @var \Pimcore\Model\Document\Editable\Wysiwyg $wysiwygElement */
$wysiwygElement = $document->getEditable('content');
var_dump($wysiwygElement->getData());
}
You've probably guessed that if you want to change value of a chosen editable or any other value, you can just set the value (by an available method) and after, save the document.
//...
/** @var \Pimcore\Model\Document\Editable\Wysiwyg $wysiwygElement */
$wysiwygElement = $document->getEditable('content');
$wysiwygElement->setDataFromResource('<p>Lorem Ipsum is simply dummy text of the printing and typesetting.</p>');
$document->save(); //save changes in the document
| Edit an Existing Document | [
-0.16174426674842834,
-0.07722742110490799,
-0.08362012356519699,
-0.0708175078034401,
-0.04747321456670761,
0.04887450486421585,
0.06895021349191666,
0.04677189141511917,
-0.3216395080089569,
0.37908023595809937,
-0.33218950033187866,
0.6704360842704773,
0.1692151129245758,
-0.01901808753... |
https://pimcore.com/docs/platform//Pimcore/Documents/Working_with_PHP_API#delete-a-document | Delete a Document
As simple or even simpler is deletion.
Just load the document and use delete method available in \Pimcore\Model\Document.
$document = \Pimcore\Model\Document::getById(110);
if ($document) {
$document->delete();
}
| Delete a Document | [
-0.09520465135574341,
-0.11036192625761032,
-0.17082995176315308,
0.043179951608181,
-0.2409156709909439,
-0.020099280402064323,
0.1065686047077179,
0.21745289862155914,
-0.2167486995458603,
0.30862531065940857,
-0.21762308478355408,
0.35034453868865967,
0.012636180967092514,
0.03122238442... |
https://pimcore.com/docs/platform//Pimcore/Documents/Working_with_PHP_API#document-listings | Document Listings | Document Listings | [
0.03910917043685913,
-0.027149274945259094,
-0.23909446597099304,
0.05286853015422821,
0.034192442893981934,
0.010154906660318375,
0.12759438157081604,
0.2453017681837082,
0.07463663816452026,
-0.09782923012971878,
-0.2274985909461975,
-0.06160198524594307,
-0.13957710564136505,
-0.0838642... |
https://pimcore.com/docs/platform//Pimcore/Documents/Working_with_PHP_API#examples | Examples
Let's assume that we have the following document tree structure:
The code below retrieves all published documents with parentId = 82:
$listing = new \Pimcore\Model\Document\Listing();
$listing->setCondition("parentId = 82");
foreach($listing as $doc) {
// do whatever you like
}
If you'd like to get also all the unpublished documents, set the following flag: $listing->setUnpublished(true);. | Examples | [
-0.31409892439842224,
0.13044536113739014,
-0.1739087700843811,
0.1739942580461502,
-0.3870398998260498,
-0.28251561522483826,
-0.11650041490793228,
0.4092392921447754,
-0.367715984582901,
0.14189545810222626,
-0.4173465669155121,
0.11969148367643356,
0.1936948001384735,
-0.195545405149459... |
https://pimcore.com/docs/platform//Pimcore/Documents/Working_with_PHP_API#configurations | Configurations
Method
Arguments
Description
setOrder()
string (asc,desc)
Set ascending or descending order type.
setOrderKey()
string
Chosen column name / names for as a order key. You can choose many order keys.
setLimit()
int
amount of collection results limit
setOffset()
int
a distance from beginning of the collection items
setCondition()
string
Your own SQL condition like in the example above.
| Configurations | [
-0.13949213922023773,
-0.07012444734573364,
-0.2299773395061493,
-0.009430848993360996,
-0.096036896109581,
0.006891094613820314,
-0.2283608764410019,
0.18802429735660553,
-0.21561427414417267,
0.11604516208171844,
-0.07694937288761139,
0.4310944676399231,
0.13261882960796356,
-0.112136080... |
https://pimcore.com/docs/platform//Pimcore/Documents/Working_with_PHP_API#methods | Methods
Method
Arguments
Description
getTotalCount()
Returns total number of selected rows.
getPaginatorAdapter()
List implements \Iterator, you could use the list as a paginator.
getItems()
int $offset, int $itemsCountPerPage
as arguments you have to specify the limit of rows and the offset.
loadIdList()
Returns complete array with id as a row.
If you want to know more about the paginator usage with lists, you should visit Working with Objects via PHP API part | Methods | [
-0.09338580816984177,
-0.19507187604904175,
-0.32751333713531494,
0.26805078983306885,
-0.2478213906288147,
0.010283415205776691,
0.04040176048874855,
0.13323649764060974,
0.10632623732089996,
0.26143693923950195,
0.03198899328708649,
0.12575745582580566,
0.058629199862480164,
-0.022926775... |
https://pimcore.com/docs/platform//Pimcore/Documents/Working_with_PHP_API#advanced-example | Advanced Example
$listing = new \Pimcore\Model\Document\Listing();
$listing->setUnpublished(1);
$listing->setCondition("`parentId` = 82")
->setOrderKey(['key', 'published'])
->setOrder('desc')
->setOffset(2)
->setLimit(2);
$listing->getTotalCount();
$listing->loadIdList();
foreach($listing as $item) {
// ...
}
Alternatively, you can use the following static method to get a listing of documents:
//list all published children from the folder
/** @var \Pimcore\Model\Document\Listing $listing */
$listing = \Pimcore\Model\Document::getList([
'unpublished' => true,
'condition' => "`parentId` = 82",
'orderKey' => ['key', 'published'],
'order' => 'desc',
'offset' => 2,
'limit' => 2
]);
| Advanced Example | [
-0.22715328633785248,
0.039135418832302094,
-0.175821453332901,
0.2575399875640869,
-0.19816306233406067,
-0.04096229746937752,
0.028518615290522575,
0.24130761623382568,
-0.15064463019371033,
0.10054174065589905,
-0.3526248335838318,
0.1654258668422699,
0.06603042781352997,
-0.11978103965... |
https://pimcore.com/docs/platform//Pimcore/Documents/Inheritance#document-inheritance | Document Inheritance
The Content Main Document setting, allows a document to inherit all of its contents from any other document which can
then be overwritten individually on field level. Notice: Properties are not inherited via Content Main Documents.
If this setting is selected and Apply new main document is clicked, all contents will be erased from the current
document and inherited from the main document. | Document Inheritance | [
-0.06433753669261932,
-0.561712384223938,
-0.09145423769950867,
0.014612474478781223,
0.0250106118619442,
0.34270185232162476,
-0.13150238990783691,
0.15346099436283112,
-0.10260975360870361,
0.18688634037971497,
0.11330968141555786,
0.02916913852095604,
0.2903285324573517,
-0.482687562704... |
https://pimcore.com/docs/platform//Pimcore/Documents/Inheritance#how-to | How-To
Drag a main document to the document where you'd like to inherit the contents (Content-Main Document in settings tab).
Press the Apply new main document button
Confirm the warning dialog
Now you can see grey spaces in the document.
If you want to overwrite any value, just click the right button on it.
| How-To | [
0.0500560887157917,
-0.22251233458518982,
-0.0482846163213253,
-0.08222295343875885,
-0.06822305917739868,
0.17135703563690186,
-0.16926246881484985,
0.30008968710899353,
-0.08170676976442337,
0.26622235774993896,
-0.04461818188428879,
0.02528034709393978,
0.25298598408699036,
-0.193053394... |
https://pimcore.com/docs/platform//Pimcore/Documents/Inheritance#content-main-document-in-the-code | Content Main Document in the Code
Using a main document doesn't change anything in the PHP API. If you load a document which has related a main document,
then values returned by it will be replaced by values from the main document (unless values are overwritten).
You can get Main document object by getContentMainDocument method available in \Pimcore\Model\Document\Page.
$document = \Pimcore\Model\Document\Page::getById(130);
dump([
'main_document' => $document->getContentMainDocument()->getKey(),
'document' => $document->getKey()
]);
| Content Main Document in the Code | [
-0.20168831944465637,
-0.2857091426849365,
-0.1522919237613678,
0.3584044277667999,
-0.2770305275917053,
0.011319749057292938,
0.0844377800822258,
0.22285065054893494,
-0.04088723286986351,
0.21781165897846222,
-0.16991816461086273,
0.3352413475513458,
0.5704960227012634,
-0.19841054081916... |
https://pimcore.com/docs/platform//Pimcore/Documents#documents | Documents
Documents are the CMS part of Pimcore and are the way to go for managing unstructured contents using pages, content snippets and navigations. | Documents | [
-0.1010342687368393,
-0.1947171837091446,
-0.1670503169298172,
-0.2631787955760956,
-0.10496870428323746,
0.06149008125066757,
-0.21859727799892426,
0.2060765027999878,
-0.6935254335403442,
0.07918693870306015,
-0.1131024956703186,
0.2401806116104126,
-0.2216804325580597,
0.115779295563697... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.