Hi guys, i'm new in Umbraco CMS.I need to create a plugin that adds a user section to the backoffice. In this section there is a text field "code" and a save button. When the "code" is installed, when rendering any page, before closing the tag, a certain JS code is inserted, in which the "code" that we saved earlier takes a certain place. How can I do it?
Can you give some more details because its not totally clear about what your goal is.
You mention, a plugin that adds a user section to the backoffice, do you mean a section like Content, Media, ... which already existst in the backoffice? Or do you mean something else with section? Also a Users section already exists.
From what I understand you need to create a new Property in your Document Type which you place on the root node ( Home node ).
Then in your views you can call this property like:
Thanks for the quick reply Michaël! Custom section - I mean the new section under the "Forms" section. I think it is called "Tree"? In that column in which there are sections "Content", "Media" etc. And new section must have a dashboard which contains textfield "Code" and button "Save".
It is necessary for each page, when rendering, add one JS code where a value from the "Code" textbox is inserted into a specific place. Even if the page is already added after installing the plugin.
is it neccesary for creating a complete new section only for one textfield?
Can you have a look at the solution I provided from my previous post? It does exactly what you want and you don't have to create a new section for it.
Also this will be rendered on each page because the Code value is located on your Home root node and using the recursive search each page under Home can access this.
Dear Michaël. I'm afraid this is a customer requirement :(
I need to write a plugin that should be easily portable between projects.
In the section that creates the plug-in, the “Code” is entered and saved, and the specified actions are performed for all pages, not just for the home page.
Thank you for your patience and help my friend.
If it does not make it difficult, I need more detailed instructions on how to do this. I study Umbraco for only 2 days :(
Dear Michaël,
I read this article, but it does not indicate what I need. I need to perform actions similar to what is stated in the article, but only with the help of the plugin I want to create. I determined that I can achieve this by specifying the correct code in the "Package Actions" section, but I do not know how to write the code there in order to achieve what I need.
Oh Michael,
i feel very stupid.
Why the plugin that you create contains .cs files?
I followed the umbraca documentation and tried to create plugins. But my plugin is an archive which contains the xml file. What am I doing wrong ?
and how can I post events on the content (I mean the button in my expected dashboard)?
Dear Michaël,
you really helped me. I finally understood what a full-fledged plugin for Umbraco consists of. And understood a lot of your work with Git.
I created a plugin that creates custom section.
I will continue to work on the content.
Dynamically adding text to View
Hi guys, i'm new in Umbraco CMS.I need to create a plugin that adds a user section to the backoffice. In this section there is a text field "code" and a save button. When the "code" is installed, when rendering any page, before closing the tag, a certain JS code is inserted, in which the "code" that we saved earlier takes a certain place. How can I do it?
Thx for the help friends!
Hi Eugen,
First, Welcome to the Umbraco Community!
Can you give some more details because its not totally clear about what your goal is.
You mention, a plugin that adds a user section to the backoffice, do you mean a section like Content, Media, ... which already existst in the backoffice? Or do you mean something else with section? Also a Users section already exists.
From what I understand you need to create a new Property in your Document Type which you place on the root node ( Home node ).
Then in your views you can call this property like:
This will look up the node structure and find a property called myCodeAlias.
Then using this line, you can get the code and add it into your script.
Hope this helps.
/Michaël
Thanks for the quick reply Michaël! Custom section - I mean the new section under the "Forms" section. I think it is called "Tree"? In that column in which there are sections "Content", "Media" etc. And new section must have a dashboard which contains textfield "Code" and button "Save". It is necessary for each page, when rendering, add one JS code where a value from the "Code" textbox is inserted into a specific place. Even if the page is already added after installing the plugin.
Thank you very much for the help!
Hi Eugen,
is it neccesary for creating a complete new section only for one textfield?
Can you have a look at the solution I provided from my previous post? It does exactly what you want and you don't have to create a new section for it.
Also this will be rendered on each page because the Code value is located on your Home root node and using the recursive search each page under Home can access this.
Hope this helps.
/Michaël
Dear Michaël. I'm afraid this is a customer requirement :( I need to write a plugin that should be easily portable between projects. In the section that creates the plug-in, the “Code” is entered and saved, and the specified actions are performed for all pages, not just for the home page.
Thank you for your patience and help my friend. If it does not make it difficult, I need more detailed instructions on how to do this. I study Umbraco for only 2 days :(
Hi Eugen,
no problem.
You can find detailed information on creating custom sections, trees and dashboard in de Documentation:
https://our.umbraco.com/documentation/Extending/Section-Trees/
https://our.umbraco.com/documentation/Extending/Dashboards/
Hope this helps!
/Michaël
One more question...How can i do it using plugins?)
Hi Eugen,
an exampel of doing this can be found here in this blogpost:
https://24days.in/umbraco-cms/2017/similar-solutions-different-approaches/
Hope this helps!
/Michaël
Dear Michaël,
I am now creating a plugin and in the tab "Package Actions" I want to add a new section with the contents as I described above.
I found examples on https://our.umbraco.com/documentation/Reference/Packaging/ . But I can't adapt it to my needs. I need to create a new section with a text field and a button as we discussed before. Сan you help me with this?
Hi Eugen,
found another post with more in depth details from adding a new section untill displaying content:
https://skrift.io/articles/archive/sections-and-trees-in-umbraco-7/
Hope this helps!
/Michaël
Dear Michaël, I read this article, but it does not indicate what I need. I need to perform actions similar to what is stated in the article, but only with the help of the plugin I want to create. I determined that I can achieve this by specifying the correct code in the "Package Actions" section, but I do not know how to write the code there in order to achieve what I need.
Hi Eugen,
then have a look at my plugin which I have created which also uses a custom section with Package Actions.
https://github.com/Mivaweb/Notely/blob/master/src/Notely/Notely.Core/Install/PackageActions.cs
The package actions is used to add, edit or remove things during install/uninstall of your package.
In my plugin I edit the config xml files which contains the details about sections and dashboards so I can add my custom section.
Hope this helps!
/Michaël
And then in the following directory you can find 2 classes which creates the section and trees in the backoffice:
https://github.com/Mivaweb/Notely/tree/master/src/Notely/Notely.Web/Trees
/Michaël
Oh Michael, i feel very stupid. Why the plugin that you create contains .cs files? I followed the umbraca documentation and tried to create plugins. But my plugin is an archive which contains the xml file. What am I doing wrong ? and how can I post events on the content (I mean the button in my expected dashboard)?
Ok now I am lost...
I think the first step you need to do is making it work by hand, so forget the Package Actions and all that stuff, first try to make your plugin work.
Hope this helps!
/Michaël
Dear Michaël, you really helped me. I finally understood what a full-fledged plugin for Umbraco consists of. And understood a lot of your work with Git. I created a plugin that creates custom section. I will continue to work on the content.
Thx you
Eugen,
no problem, I am glad I could help you out! Keep up reading the docs and don't hesitate to ask questions on the forum.
We are here to help you out!
Have a nice evening!
/Michaël
Hi Eugen,
don't forget to mark the solution for this thread.
Thanks!
Have a nice day
/Michaël
is working on a reply...