Hey , I’m trying to render Data from Entity model to use them inside the inspector , I have made DataSource that gets all the objects properties like url and title , the problem is that the Value key in the output Json object is a string and I cannot store nseted array inside it to use it later in the typoscript file :
prototype(Mysite.Posts:Plugin) < prototype(TYPO3.Neos:Content) {
templatePath = 'resource://Mysite.Posts/Private/Templates/NodeTypes/Post.html'
element_title = ${q(node).property('etitle')}
}
Inside the Nodetypes configuration file I hace this nodetype :
properties:
etitle:
type: string
ui:
reloadIfChanged: true
label: 'List of Posts'
inspector:
group: image
editor: TYPO3.Neos/Inspector/Editors/SelectBoxEditor
editorOptions:
dataSourceIdentifier: mysite-posts-test
My question is how to get more than the Post title ? the nodetype return only the title of the post using the DataSource Value key inside the returned array, how can I get the title and the other properties inside that Entity ? can I do that for example inside the typoscript ? :
prototype(Mysite.Posts:Plugin) < prototype(TYPO3.Neos:Content) {
templatePath = 'resource://Mysite.Posts/Private/Templates/NodeTypes/Post.html'
element = ${q(node).property('etitle')}
element_title = ${q(node).property('etitle')['getTitle']}
element_url = ${q(node).property('etitle')['getUrl']}
}
this is the getData method inside the DataSource :
/**
* Get data
*
* @param NodeInterface $node The node that is currently edited (optional)
* @param array $arguments Additional arguments (key / value)
* @return array JSON serializable data
*/
public function getData(NodeInterface $node = NULL, array $arguments)
{
$postsArr = array();
foreach ($this->postRepository->findAll() as $post) {
$postsArr[] = array(
'value' => $teaser->getPostTitle(),
'label' => $teaser->getPostTitle(),
'group' => '',
'icon' => '',
);
}
return $postsArr;
}
I hope you understood my question
Thank you