Nodetype Properties werden nicht Verarbeitet?


(Sascha Hoerner) #1

Hallo,

ich bräuchte hilfe, ich habe bereits länger mit Neos gearbeitet (angefangen bei Neos 1.2) und bisher hatte ich keine Probleme ein Paket wo die Properties überschrieben / gesetzt werden wie gewünscht anzulegen nur seit Neos LTS wurde ja einiges geändert. Und ich bekomme mein Plugin nicht zum laufen (bzw, nicht so wie gewünscht) ich habe ein Plugin angelegt, damit ich Bootstrap Buttons setzen kann wenn ich diese benötige (der Button selbst Funktioniert auch). Nur die Properties nicht, Die Property “iconSA” sollte dem Script entsprechend Fontawesome Icons setzen die ich im Dropdown im Nodetype auswählen kann.

wurde da etwas geändert, oder Fehlt mit einfach was? wie man an der Template Line sehen kann, Probiere ich die properties auszugeben / zu setzen.

{iconSa}

Neos selbst beschwert sich nicht darüber (und ich hab dies ja vorher auch bereits so gemacht) die Webseite bzw. das Plugin nimmt das “{iconSa}” bzw. “{btext}” wie es scheint war, aber das Feld wird wie es scheint einfach Leer Übergeben.

Template:

<div{attributes -> f:format.raw()}>
     <a class="btn btn-info btn-responsive" href="{blink}"><i class="{iconSa}"></i>{btext}</a>
</div>

Fusion:

prototype(enraged.buttons:Buttons) < prototype(Neos.Neos:Plugin)
prototype(enraged.buttons:Buttons) {
templatePath = ‘resource://enraged.buttons/Private/Layouts/Default.html’

 blink = ${q(node).property('blink')}

iconSa = ${q(node).property(‘iconSa’)}
}

Nodetypes:

‘enraged.buttons:Buttons’:
superTypes:
‘Neos.Neos:Plugin’: TRUE
ui:
label: 'Bootstrap Buttons’
group: 'plugins’
icon: 'icon-bars’
inspector:
groups:
bbutton:
label: 'Button’
properties:
iconSa:
type: string
defaultValue: 'icon-globe’
ui:
reloadIfChanged: TRUE
label: 'Icon Selection’
inspector:
group: 'bbutton’
editor: 'Neos.Neos/Inspector/Editors/SelectBoxEditor’
editorOptions:
values:
‘fa fa-envelope-o’:
label: ‘E-mail’
‘fa fa-server’:
label: ‘Server’
'fa fa-asterisk ':
label: 'Asterisk’
blink:
type: string
translatable: TRUE
defaultValue: 'Enter Link here’
ui:
inlineEditable: TRUE
reloadIfChanged: FALSE
label: 'Button Link’
inspector:
group: ‘bbutton’

Ausgabe des Templates im Browser:

 <div>
     <a class="btn btn-info btn-responsive" href=""><i class=""></i></a>
 </div>

wie man sieht steht bei (href="" und bei i class="" nichts drin) hat jemand eine idee? (sollte ich etwas Vergessen haben bitte darauf hinweisen, ich suche nun schon seit einigen Stunden nach meinem Problem aber auch beim Googeln / hier im Forum konnte ich dazu nichts finden).

Eine andere Frage die sich mir noch stellt ist, wie kann ich den den “Neos Link selector in einem Plugin verwenden”?

meine Webseite: enraged.eu

Gruß

Sascha Ryuujin Hoerner


(Martin Ficzel) #2

I think this should be a template and no plugin.

prototype(enraged.buttons:Buttons) < prototype(Neos.Fusion:Template)

I did not look at the whole code so there may be other problems aswell.


(Sascha Hoerner) #3

Hello,

thank you for the response, well it does even not work as “Neos.Fusion:Template” i needed to set “Neos.Neos:Content” (got that from an old Plugin where i used the same way to get a CSS class set). But then it still was not working correctly, so i did took a look at my old Plugin i created as i was working with neos 2.x But i could not find a cause (any difference in the configuration) for my Problem.

As i was still trying to get it to work, i was a bit frustrated, and removed my new “nodetype” i wrote for the Button Plugin, then i copied the Nodetype of the Old Working Plugin and changed it’s name and the properties, now it’s working and i think this is pretty strange, the only difference i could find was this:

Old Plugin:

{namespace ts=TYPO3\TypoScript\ViewHelpers}
{namespace neos=TYPO3\Neos\ViewHelpers}

didn’t they got changed to:

{namespace ts=Fusion\TypoScript\ViewHelpers}
{namespace neos=Neos\Neos\ViewHelpers}

?

or what is the correct namespace i need to set?


(Martin Ficzel) #4

You are right Neos.Neos:Content is the parent prototype for content. That prototype is based on Neos.Fusion:Template but adds the needed class-wrapping for editing in the backend.

The namespaces should be

# better rename ts to fusion 
{namespace ts=Neos\Fusion\ViewHelpers}  
{namespace neos=Neos\Neos\ViewHelpers}

I think you are struggeling with the default fusion code that is generated depending on your nodeType-supertype. For the SuperTypes Document, Content and Plugin different default fusion code is created.

Look at http://neos.readthedocs.io/en/stable/CreatingASite/NodeTypes/NodeTypeDefinition.html for options.fusion.prototypeGenerator

The main error in your code is that you use the SuperType Neos.Neos:Plugin instead of Neos.Neos:Content.

With 3.0 the default Fusion code for Plugin NodeTypes was changed an actual working version. Before it behaved the same as Content wich did not work for a real Neos.Plugin. A plugin is meant as a way to integrate Flow-Controller-Actions as Content into Neos. See http://neos.readthedocs.io/en/stable/ExtendingNeos/CreatingAPlugin.html for that.

What you are doing is creating a Content. The SuperType to use for that is Neos.Neos:Content this is explained here http://neos.readthedocs.io/en/stable/CreatingASite/RenderingCustomMarkup/CustomContentElements.html


(Sascha Hoerner) #5

First i want to say thank you for your helpfull responses.

Yes you are right, i missed to edit my post here, as i found this issue already by yesterday but this was not the cause for my issue. As i had written above as i did copy an old nodetype definition (this morning), and just changed needed changes (from Neos 2.x -> Neos 3.x) the Plugin started to work as you can see on the Screenshot there are 4 Buttons (grey / green / yellow / red) i can change via Neos Backend (CSS Properties / Text Inline Editable / and a Fontawesome icon for the button if wanted)

Thanks for this information, i didn’t knowed that btw. it seems that i missed that :slight_smile:

The Plugin is working, i just need to find out how to use the “link selector” of neos to set the links, currently i just have a field where i can type “mysite.html” to get the link set.

Regards

Sascha Ryuujin Hoerner


(Martin Ficzel) #6

Use this for the link property http://neos.readthedocs.io/en/stable/References/PropertyEditorReference.html#property-type-string-linkeditor-link-editor-for-internal-external-and-asset-links

And add this to the fusion code

myLink = ${q(node).property('myLink'}
myLink.@process.convertUris = Neos.Neos:ConvertUris

(Sascha Hoerner) #7

Hello,

thank you now i feel a bit dumb as i read this article already, but didn’t saw the “link editor” even used the search and was not able to find it :confused: now i have added it to my config, and the Link Editor does work, but if i check the Link i get the “node ID” is this normal?

i did set the “page” impressum at the Link editor, and i got the “link on the button like this”:

node://53325c30-5c2f-4682-89df-209aef6e5e99

when i click on the link, then i get an “error address not recognized” from my Browser.

If i understand the fusion code correctly, then the process should convert this to a normal link or is it the otherway around, and it will create the “node link”? can i set it with “{myLink}” or do i miss something again, and i need to set another command?

i hope this is the last time i need to ask a question for this plugin :stuck_out_tongue: so far it’s working as wanted, i only need to fix my link setting :smiley:

regards

Sascha Ryuujin Hoerner


(Martin Ficzel) #8

The node://-Uri is correct. This is how Neos stores links to nodes internally. If you select a media asset the Uri will be asset://… only external Uris are stored directly. The reason is that a link to another node can change at any time if the node is moved. Neos will still create valid URLs in this case because it referenced the identifier of the node.

The @process.convertUris … thingy should convert the node:// to an http://-uri for the frontend. Sometimes you will have to add an @if.isInBackend to avoid linking in the backend. For instance to edit the text on a button inline without triggering the link.

Regards, Martin


(Martin Ficzel) #9

This is the reference to ConvertUris: http://neos.readthedocs.io/en/stable/References/NeosFusionReference.html#converturis


(Martin Ficzel) #10

Entschuldige die englischen Antworten … ich war im Automatik-Modus … habe gerade erst gemerkt das da ja eine deutsche Frage war.


(Sascha Hoerner) #11

Hi,

joa kein Problem :wink: mir passiert das auch oft das ich das “Umschalten” verplane auf der Arbeit, und schon schreibe ich Kunden teilweise mal auf English obwohl die Kunden aus Deutschland stammen :slight_smile: ich Danke dir jedenfalls für deine Hilfe, ich werde mir das nun mal zu gemüte führen, verstehe aktuell nicht warum ich im Frontend den “node link” erhalte der ja eigentlich fürs backend gedacht ist.

Ich wünsche ein schönes Wochenende.