(Typo3) How can i access content from a subpage when its inside a mask-content element? - typo3

I've used the Mask-Extension in TYPO3 to create a custom content element for news articles.
Now I want to generate a thumbnail preview on the news parent page that contains images and texts from that mask element.
This means I need to access the data inside of a custom content element of a foreign page.
I've used <f:debug> to see if I can get information from the {data} Array on the page / childpage but there is nothing with content of the mask element.
I suspect that I might need to add a new dataProcessor in my setup.typoscript, but I do not understand how those work well. Mask has its own dataProcessor but I was unable to include it inside my extension.
Do I need to work with dataProcessors here at all and if yes how do I do that?
The field names of the mask-news element are:
tx_mask_news_innertext
tx_mask_news_innerpicture
The tca in mask.json looks like this:
"tca": {
"tx_mask_news_innerpicture": {
"cTypes": [
"image"
],
"config": {
"appearance": {
"collapseAll": 1,
"enabledControls": {
"dragdrop": 1
},
"levelLinksPosition": "top",
"showAllLocalizationLink": 1,
"showPossibleLocalizationRecords": 1,
"useSortable": 1
},
"foreign_sortby": "sorting",
"foreign_table": "tt_content",
"overrideChildTca": {
"columns": {
"colPos": {
"config": {
"default": 999
}
}
}
},
"type": "inline"
},
"description": "",
"key": "news_innerpicture",
"l10n_mode": "",
"name": "content"
},
"tx_mask_news_innertext": {
"config": {
"enableRichtext": 1,
"richtextConfiguration": "",
"type": "text"
},
"description": "",
"key": "news_innertext",
"l10n_mode": "",
"name": "richtext"
},

Related

Azure Data Factory Copy Data activity - Use variables/expressions in mapping to dynamically select correct incoming column

I have the below mappings for a Copy activity in ADF:
"translator": {
"type": "TabularTranslator",
"mappings": [
{
"source": {
"path": "$['id']"
},
"sink": {
"name": "TicketID"
}
},
{
"source": {
"path": "$['summary']"
},
"sink": {
"name": "TicketSummary"
}
},
{
"source": {
"path": "$['status']['name']"
},
"sink": {
"name": "TicketStatus"
}
},
{
"source": {
"path": "$['company']['identifier']"
},
"sink": {
"name": "CustomerAccountNumber"
}
},
{
"source": {
"path": "$['company']['name']"
},
"sink": {
"name": "CustomerName"
}
},
{
"source": {
"path": "$['customFields'][74]['value']"
},
"sink": {
"name": "Landlord"
}
},
{
"source": {
"path": "$['customFields'][75]['value']"
},
"sink": {
"name": "Building"
}
}
],
"collectionReference": "",
"mapComplexValuesToString": false
}
The challenge I need to overcome is that the array indexes of the custom fields of the last two sources might change. So I've created an Azure Function which calculates the correct array index. However I can't work out how to use the Azure Function output value in the source path string - I have tried to refer to it using an expression like #activity('Get Building Field Index').output but as it's expecting a JSON path, this doesn't work and produces an error:
JSON path $['customFields'][#activity('Get Building Field Index').outputS]['value'] is invalid.
Is there a different way to achieve what I am trying to do?
Thanks in advance
I have a slightly similar scenario that you might be able to work with.
First, I have a JSON file that is emitted that I then access with Synapse/ADF with Lookup.
I next have a For each activity that runs a copy data activity.
The for each activity receives my Lookup and makes my JSON usable, by setting the following in the For each's Settings like so:
#activity('Lookup').output.firstRow.childItems
My JSON roughly looks as follows:
{"childItems": [
{"subpath": "path/to/folder",
"filename": "filename.parquet",
"subfolder": "subfolder",
"outfolder": "subfolder",
"origin": "A"}]}
So this means in my copy data activity within the for each activity, I can access the parameters of my JSON like so:
#item()['subpath']
#item()['filename']
#item()['folder']
.. etc
Edit:
Adding some screen caps of the parameterization:
https://i.stack.imgur.com/aHpWk.png

Add custom command to own VS Code extention in "view/title"

I'm trying to add my own command in a Visual Studio Code extension in the upper "view/title" row. For example, like the built-in "Extension"-View:
I couldn't figure out from the menu-contributions API how this works. I specified a custom ViewContainer in the package.json, which in turn contains multiple views:
{
"viewsContainers": {
"activitybar": [
{
"id": "my-view",
"title": "My View",
"icon": "media/logo.png"
}
]
},
"views": {
"my-view": [
{
"id": "profiles",
"name": "Profiles"
},
{
"id": "templates",
"name": "Templates"
}
]
}
}
Since I have a command that goes across all views, I would like to have the button at the height of the ViewsContainer (as in the image). Is that possible?

Getting expected object definitions from Magento 2 REST API

When calling the Magento 2 REST API to get the schema for working with products using:
..rest/all/schema?services=catalogProductRepositoryV1
The response back includes:
...
"paths": {
"/V1/products": {
"post": {
"tags": [
"catalogProductRepositoryV1"
],
"description": "Create product",
"operationId": "catalogProductRepositoryV1SavePost",
"parameters": [
{
"name": "$body",
"in": "body",
"schema": {
"required": [
"product"
],
"properties": {
"product": {
"$ref": "#/definitions/catalog-data-product-interface"
},
"saveOptions": {
"type": "boolean"
}
},
"type": "object"
}
}
],...
How do you go about getting the definition/schema for the "product" object that it expects during a POST call? i.e. the following definition:
"properties": {
"product": {
"$ref": "#/definitions/catalog-data-product-interface"
},
Looks like its only possible using the swagger GUI. Essentially replicate these steps and change your search term for whatever you're searching for:
Go to: http://devdocs.magento.com/swagger/index.html
Ctrl + f >> search for whatever you're after. In the case of the above: catalogProductRepositoryV1
Expand the API interface by clicking it
Choose your REST Method
Under "Parameters" there will be a Model/Model Schema showing you what payload it expects.
Welcome to Swagger! It's great when you know how to use it!

SAPUI5 - create a JSONModel from Ajax response

I'm trying to build a SAPUI5 application using JSON model.
I want to add 2 dropdown select menus, so that the second one fills in depending on the current selection of the first one.
I tried to get it done, but stucked at the very beginning.
This is what I get from Ajax (the object itself is passed from the server):
var data = {
"firm1":["firm1project1","firm1project2","firm1project3"],
"firm2":["firm2project1","firm2project2","firm2project3"],
"firm3":["firm3project1","firm3project2","firm3project3"],
"firm4":["firm4project1","firm4project2","firm4project3"]
};
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(data);
sap.ui.getCore().setModel(oModel);
The first menu should be the list of firms and the second one - is the selected firm's projects. And now I have no idea how to bind the data to the controls the right way.
Thank you.
EDIT:
According to what I've read in the developer's guide, the data that should appear in different controls is contained under fixed keys (as shown in "Aggregation Data Binding in a Simple Application" part of the page that I linked above), so it would be possible to just write something like:
var oListItemTemplate = new sap.ui.commons.ListItem("ListItemTemplate", {
text : "{firm}",
});
and for the projects:
var oListItemTemplate = new sap.ui.commons.ListItem("ListItemTemplate", {
text : "{firm/project}",
});
But in my case there is no firm key. My ListItems for the firm selection menu are keys, not values. And ListItems for the project selection menu are in an array, not just separate values under fixed keys.
So, is there a way or to bind somehow the data I have in its current form to controls, or how the data should look like to be useful for binding?
your data looks better like the following, the data binding JSON objects are with keys. And there are two data models needed for two dropdown boxes, multi data model binding should be used. I did a example at JSBin which fulfills your requirements, you can have a look and get some thoughts.
{
"firms": [
{
"name": "firm1",
"projects": [
{
"name": "firm1project1"
},
{
"name": "firm1project2"
},
{
"name": "firm1project3"
}
]
},
{
"name": "firm2",
"projects": [
{
"name": "firm2project1"
},
{
"name": "firm2project2"
},
{
"name": "firm2project3"
}
]
},
{
"name": "firm3",
"projects": [
{
"name": "firm3project1"
},
{
"name": "firm3project2"
},
{
"name": "firm3project3"
}
]
},
{
"name": "firm4",
"projects": [
{
"name": "firm4project1"
},
{
"name": "firm4project2"
},
{
"name": "firm4project3"
}
]
}
]
}

extjs nested data view select a node

i have data view with following tpl.
<tpl for=".">
<tpl for="departments">
{title}
</tpl>
<tpl for="records">
<div class="thumb-wrap">
{name}
</div>
</tpl>
</tpl>
and my json redear like this
reader : new Ext.data.JsonReader(
{
root : 'data',
},
[
'departments' ,
'records'
]
),
and my item selectore in on my recordes
itemSelector : 'div.thumb-wrap',
and this is my json data
{
"success": true,
"data": [
{
"departments": [
{
"title": "name"
}
],
"records": [
{
"name": "name"
},
{
"name": "name"
}
]
},
{
"departments": [
{
"title": "name"
}
],
"records": [
{
"name": "name"
}
]
}
]
}
how cat i select my records in data view with extjs?
and how can i get selected recordes ?
i used getSelectedRecords() but it return array of departments and records.
tnx
I'm pretty sure that getSelectedRecords() is deprecated on ExtJS 4.
You can try doing something like this:
var records = data.getRecords();
That will return a Ext.data.Model[]. Than, you can access all the properties like an usual model:
record.get('departments');
record.get('records');
You are working against the system here with your record structure. DataView wants one record to correspond with one selectable item. But you want to have multiple selectable items inside one record. Doesn't work - the API was not designed for such a thing.
Your options seem to be:
Create a separate DataView component for each set of records.
Create your own DataView component that can handle grouping.
Use Grid with GroupingView. You have to change your record structure to something like below, but it's the easiest option to get working. Though... you have to sacrifice quite a bit of flexibility offered by DataView.
"data": [
{
{
"department": "Department 1"
"name": "record 1"
},
{
"department": "Department 1"
"name": "record 2"
},
{
"department": "Department 2"
"name": "record 1"
},
{
"department": "Department 2"
"name": "record 2"
},
]
}