What does editElementQuery do? - aem

I've came across some examples of a richtext field that has a property called editElementQuery but nobody says what it does. I couldn't find any documentation on it either.
One of the examples is in the stackoverflow question bellow:
AEM/CQ5 html5smartimage filename lost on image upload
Does anybody know what this is suppose to do?

this field is here for storing the selector of the element that should be opened / edited in case of inline edition of that property.
If not fed, the first block element will be taken.

Here is a good explanation what does editElementQuery do:
https://medium.com/#koen_/boost-your-aem-authors-experience-85b2aef04422
Here is a small piece of _cq_editConfig.xml file where I have used this field:
<cq:inplaceEditing
jcr:primaryType="cq:InplaceEditingConfig"
active="{Boolean}true"
editorType="text">
<config jcr:primaryType="nt:unstructured"
editElementQuery="div.rich-text-component__text">
<rtePlugins jcr:primaryType="nt:unstructured">
...
</rtePlugins>
</config>
</cq:inplaceEditing>
I share this config here because I had difficulties in finding where to put this editElementQuery property.

Related

DITA: reuse the same text multiple times with different variable setting for each instance

I'm working on a document where, among other things, I need to explain two units that are very similar. I want to reuse text in both descriptions, but I want to use the name of the units in the shared text, and to configure a form of substitution/variable so the name of the units appear in each description. Note that the description of both units appear in the final document.
We're using a structure like this:
top.ditamap, which includes:
units_a_and_b.ditamap, which includes:
unit_a.dita
unit_b.dita
and then this file with text snippets:
unit_a_b_shared.dita
unit_a.dita and unit_b.dita will conref text snippets from unit_a_b_shared.dita.
So basically I want unit_a_b_shared.dita to contain something like this:
"When you configure DOODAA to ..."
and then I want DOODAA to be replaced with unit_a inside the unit_a part of the document, and with unit_b inside the unit_b part.
I've tried to use keywords for this, but so far without success. I haven't found a way to make them take on different values in the different files, even when using keyscopes as explained here:
https://blog.oxygenxml.com/keyscopes/keyscopesBlog.html
The problem seems to be that with keyscopes I need the full path, which includes which unit it is, and hence cannot be used in the text snippet which is shared. Without keyscopes the first definition of the keyword applies everywhere.
Any suggestions on how to achieve this goal (using keywords or not)?
I wrote that key scopes article on the Oxygen XML Blog and I think that key scopes seem to be the answer for your case.
So the "unit_a_b_shared.dita" file would have inside a something like:
<p id="reusablePara">some text before <ph keyref="unit"/> some text after</p>
And then in the DITA Map you would refer to ""unit_a_b_shared.dita"" in different key scopes and re-define the key "unit" in those places to bind it to a different value.
The DITA Map would need to look like this:
<map>
<title>Main</title>
<topicref href="unit_a.dita" keyscope="unitA">
<keydef href="unit_a_b_shared.dita" keys="reusables"/>
<keydef keys="unit">
<topicmeta>
<keywords>
<keyword>KM</keyword>
</keywords>
</topicmeta>
</keydef>
</topicref>
<topicref href="unit_b.dita" keyscope="unitB">
<keydef href="unit_a_b_shared.dita" keys="reusables"/>
<keydef keys="unit">
<topicmeta>
<keywords>
<keyword>KG</keyword>
</keywords>
</topicmeta>
</keydef>
</topicref>
</map>
and inside "unit_a.dita" you would conkeyref to the reusable paragraph inside the "unit_a_b_shared.dita" file:
<p conkeyref="reusables/reusableParagraph"/>
Note that I'm using "conkeyref" not "conref". Once you get to use key scopes you should avoid direct links or direct content references, use only indirect linking using keys.

Link to file in Fluid – how to specify storage?

As far as I know, there's no such thing as an f:link.file or v:link.file viewhelper.
There used to be a solution using file.originalResource.publicUrl as the value to point the link to, as in
<f:link.page pageUid="{file.originalResource.publicUrl}" target="_blank">
Am I right that this is no longer necessary? I got this (using ext:mask):
<f:link.page pageUid="{file.identifier}" target="_blank">
returning the same value, while originalResource.publicUrl would not even show up in f:debug.
BUT in file.identifier the storage path, e.g. fileadmin, is not present. How do I add it to the viewhelper?
Or, what is the currently recommended solution for a link to a file in TYPO3 7.6?
Just use {file.name}. When absolute URL or some special configuration is needed use <f:link.typolink parameter="{file.publicUrl}">{file.name}</f:link.typolink>.
TYPO3 11 introduced a new ViewHelper for this
<f:link.file file="{file}" target="_blank">Download</f:link.file>
https://docs.typo3.org/other/typo3/view-helper-reference/11.5/en-us/typo3/fluid/latest/Link/File.html
For me, #minifranske’s solution worked only as a hint: I needed to use {file.originalResource.publicUrl} instead:
<f:link.typolink parameter="{file.originalResource.publicUrl}">{file.originalResource.title}</f:link.typolink>
also available:
{file.originalResource.name}
{file.originalResource.description}
{file.originalResource.alternative}
Nevertheless, if anybody knows a proper core solution which resembles that of the Rich Text Editor, I’d be happy to hear about it:
file link
page link
<f:uri.image image="{imageObject}" /> produces the path + filename for your FAL object.

Having multiple cq:dropTargets in one component

I've managed to implement my single cq:dropTarget into my component with the following sightly code:
<div data-sly-test="${wcmmode.edit}" class="cq-dd-videoplayer" data-sly-text="Drop video here"></div>
And the cq:dropTargets is setup like so:
<cq:dropTargets jcr:primaryType="nt:unstructured">
<videoplayer
jcr:primaryType="cq:DropTargetConfig"
accept="[video/.*]"
groups="[media]"
propertyName="./videoPath"/>
</cq:dropTargets>
This works perfectly... The issue I'm having is having multiple cq:dropTargets in the one component. The issue I have is when I drop an asset into one of the cq:dropTargets both values in the dropTargets are updated with the same value.
This is my current setup:
Sightly:
<div data-sly-test="${wcmmode.edit}" class="cq-dd-videoplayer cq-video-placeholder cq-block-sm-placeholder md-dropzone-video" data-sly-text="Drop video here"></div>
<div data-sly-test="${wcmmode.edit}" class="cq-dd-imageofplayer cq-video-placeholder cq-block-sm-placeholder md-dropzone-video" data-sly-text="Drop image here"></div>
cq:dropTargets
<cq:dropTargets jcr:primaryType="nt:unstructured">
<videoplayer
jcr:primaryType="cq:DropTargetConfig"
accept="[video/.*]"
groups="[media]"
propertyName="./videoPath"/>
<imageofplayer
jcr:primaryType="cq:DropTargetConfig"
accept="[image/.*]"
groups="[media]"
propertyName="./imagePath"/>
</cq:dropTargets>
so now the ./videoPath and ./imagePath become the same value from the dragged in asset.
On the 22nd of August 2015 has been released a new featurepack CQ-6.1.0-FEATUREPACK-6563 which solved this problem.
Related bugs fixed:
- CQ-39715 - Make multiple in-place editors smarter
- CQ-41631 - Can't place multiple fileupload widgets on the same dialog
- CQ-42676 - Inplace editing does not work for static included components
So now you need to create inside cq:inplaceEditing a node called cq:childEditors primaryType unstructured and inside that one node type cq:ChildEditorConfig for each element composed by two properties: "title" and "type" where title will be showed in a dropdown menu when you click on the edit link. I created a 3 columns image component and I can drag-and-drop images from the Content Finder for each of them.
Also the Configure section is working with 3 tabs where I can drag-and-drop/upload images for each of them.
I suggest to use wcm/foundation/components/textimage as example.
References: https://docs.adobe.com/docs/en/aem/6-1/develop/components/multiple-inplace-editors.html
Are you trying to drop an image after video?
If so, just looking at your cq:dropTargetConfig for "imageofplayer",
according to docs,
accept property value should be "Regex applied to the asset mime type to validate if dropping is allowed."
So if you are trying to drop an image , it should be:
accept="[image/.*]"

TYPO3: get path out of file reference in Extbase

i've created a Custom Content Element with Fluid and Extbase (TYPO3 6.1), in which you can define a picture.
In the picture-settings i can set a img-link, which is targetting a file.
In my Controller i can access this data with
$this->configurationManager->getContentObject();
But i just get a file-reference for this setting and no path. like this:
file:1206
I've googled a lot and i didn't find a solution to access the path. Has anybody a solution or knows maybe a function in the configurationmanager or something else? I've spend hours on this problem...
Thanks a lot!
If you need to get image from FAL than use following image view helper
<f:image src="{object.image_field.uid}" alt="{object.image_field.originalResource.title}" width="640" height="291" treatIdAsReference="1" />
If you just need url of image than use following line
{object.image.originalResource.publicUrl}..
Hurray.
What you have there, is a file reference of FAL, the file abstraction layer.
First things first, if you use FlexForms in combination with ActionController (or any realisation of AbstractController) you should be able to access the settings property to compute your FlexForm values.
To compute sys_file_reference records, you should refer to the FAL docs on typo3.org (and the perma-linked section about file and folder handling).
In general, you should be able to call getOriginalResource() on a \TYPO3\CMS\Extbase\Domain\Model\FileReference object. For more concrete examples, either refer to the doc links or have a look at the wiki for a example handling FileReferences.
If you want to compute such reference via fluid templating, you can use the treatIdAsReference argument on f:image:
<f:image src="{imageObj.uid}" width="150" height="100" treatIdAsReference="1" />
He is asking for a path and not for an image. This prints the path in fluid templates:
{f:uri.image(src:'{object.uid}',treatIdAsReference:'1')}

Creating a working copy for Plone 4 custom content types

I have created a custom Plone content type in my package i.e. my.product.
I am in need of integrating a working copy support: so that a "published" document (in my case, a published content type) stays online while it is being edited. Basically, I want to take advantage of 'Working Copy Support (Iterate)' provided by plone.app.iterate to achieve what is explained here. This will provide me with ability to check-in/check-out my changes.
Is this possible in Plone 4 with custom content types using Archetypes? How would one go about it if yes?
I added the following two files inside my.product/my/product/profiles/default folder and it appears to work:
diff_tool.xml
<?xml version="1.0"?>
<object>
<difftypes>
<type portal_type="MyCustomType">
<field name="any" difftype="Compound Diff for AT types"/>
</type>
</difftypes>
</object>
repositorytool.xml
<?xml version="1.0"?>
<repositorytool>
<policymap>
<type name="MyCustomType">
<policy name="at_edit_autoversion"/>
<policy name="version_on_revert"/>
</type>
</policymap>
</repositorytool>
I have never used plone.app.iterate, but this is the generic approach how to solve the problem.
Actions are installed by plone.app.iterate GenericSetup profile. You can see actions here:
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/profiles/default/actions.xml
Pay note to the line *available_expr* which tells when to show the action or not. It points to helper view with the conditition.
The view is defined here
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/configure.zcml#L7
The checks that are performed for the content item if it's archiveable
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/control.py#L47
Most likely the failure comes from if not interfaces.IIterateAware.providedBy condition. Your custom contennt must declare this interface. However, you can confirm this putting a pdb breakpoint in checkin_allowed(self) and step it though line-by-line and see what happens with your content type.