Add a block with an button on a site
Permalink
Dear all,
I want to add a block with a button (without beeing in edit mode) on the site and not from the stebar.
This should be like a protocol, evn the same block has to be added week by week or twce a week. It should be easy like it can be, so I want to use a button on the end of the site (in footer) to add a block to main.
How can I do this?
Thanks in advance
gunter
I want to add a block with a button (without beeing in edit mode) on the site and not from the stebar.
This should be like a protocol, evn the same block has to be added week by week or twce a week. It should be easy like it can be, so I want to use a button on the end of the site (in footer) to add a block to main.
How can I do this?
Thanks in advance
gunter
How can you add a block to a page without being in edit mode though?
That is the question.
I'll make it so compfortable as possible.
- I'll like to click on a butten
- The site goes to edit mode
- The block form will be shown
- After I click on save the block will be added as the last block to the site and the site goes to view mode.
- The site with the new block will be shown.
Thanks in advanced
Gunter
I'll make it so compfortable as possible.
- I'll like to click on a butten
- The site goes to edit mode
- The block form will be shown
- After I click on save the block will be added as the last block to the site and the site goes to view mode.
- The site with the new block will be shown.
Thanks in advanced
Gunter
Hello,
There are a few problems that need to be taken care of first.
When you click on the button, does it allow you to select a block type? Obviously, a block type has to be specified. So let's say you click on a button to see a list of blocks and then you click on a block to select it. That's 2 clicks.
The site goes in edit mode, the block's form appears, you click save and the block is added as the last block to the site.
But in which area? Typically a page has more than one area, each a separate entity. Where should the block go?
You probably need another click to select an area. That's 3 clicks.
To summarize, adding a block to a page is the result of at least 2 totally separate choices:
1- block type
2- Area
So only one click seems impracticable.
I'd love to be wrong though so if anybody has an idea on how to make this work, that would be great
There are a few problems that need to be taken care of first.
When you click on the button, does it allow you to select a block type? Obviously, a block type has to be specified. So let's say you click on a button to see a list of blocks and then you click on a block to select it. That's 2 clicks.
The site goes in edit mode, the block's form appears, you click save and the block is added as the last block to the site.
But in which area? Typically a page has more than one area, each a separate entity. Where should the block go?
You probably need another click to select an area. That's 3 clicks.
To summarize, adding a block to a page is the result of at least 2 totally separate choices:
1- block type
2- Area
So only one click seems impracticable.
I'd love to be wrong though so if anybody has an idea on how to make this work, that would be great
Ok I'll make it simple for the user.
- I have a button (block is defined)
- I have a defined area (main)
- With clicking on the button I'll bring up the form
- With clicking on save the block should be added to the defined area
- With clicking on cancle nothing should be happen
This should be like in this forum (adding a post)
Best regards
Gunter
- I have a button (block is defined)
- I have a defined area (main)
- With clicking on the button I'll bring up the form
- With clicking on save the block should be added to the defined area
- With clicking on cancle nothing should be happen
This should be like in this forum (adding a post)
Best regards
Gunter
You'll probably need a custom page type with template for this.
I thought I can use a custom block for the buttom, define the custom block, to add, in this.
So the page is known, the area is defined. Now I only need to know how to handle this in the code.
If I use addBlock I need the data of the block but I want to show the form to get the data.
Best regards
Gunter
So the page is known, the area is defined. Now I only need to know how to handle this in the code.
If I use addBlock I need the data of the block but I want to show the form to get the data.
Best regards
Gunter
OK so what you're trying to do is sort of alter the core editing functionality?
If you don't mind me asking, what is wrong about clicking the pencil to enable editing and adding the new block to the site the way we normally do?
If you don't mind me asking, what is wrong about clicking the pencil to enable editing and adding the new block to the site the way we normally do?
I'll will realze a method for users, not Editors, to bring a custom block up (like the answer function in a block but with a more complex for like a textfield).
I think it can work with a view custom blocks:
1. Custom block:
You cann chose the block type (in edit mode)
You can chose the button text (in edit mode)
After clicking on the button the page goes in edt mode an the form opens
2. Custom block
You can edit all needed informations (page is in edit mode)
After clicking on save the block will added at last block in the conent area and the page will published.
I think all informations can be found (page, area, block).
But I do not know how to open a form programmatical in an specified area and set the page to published after saving the data.
Thanks in advanced
Gunter
I think it can work with a view custom blocks:
1. Custom block:
You cann chose the block type (in edit mode)
You can chose the button text (in edit mode)
After clicking on the button the page goes in edt mode an the form opens
2. Custom block
You can edit all needed informations (page is in edit mode)
After clicking on save the block will added at last block in the conent area and the page will published.
I think all informations can be found (page, area, block).
But I do not know how to open a form programmatical in an specified area and set the page to published after saving the data.
Thanks in advanced
Gunter
I note that there's a Page::addBlock() function:
http://documentation.concrete5.org/api/class-Concrete.Core.Page.Pag...
However, it's not documented.
http://documentation.concrete5.org/api/class-Concrete.Core.Page.Pag...
However, it's not documented.