Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Init() method to Blocks #837

Closed
pklingl opened this issue Oct 2, 2019 · 2 comments
Closed

Add Init() method to Blocks #837

pklingl opened this issue Oct 2, 2019 · 2 comments

Comments

@pklingl
Copy link

pklingl commented Oct 2, 2019

Hi I am enjoying using Piranha, very easy to work with!

My question:
Is there the ability to write a controller for a new block type?
In the block example, it appears that any logic needs to be applied in the view?

I am trying to setup a block that outputs the body element of sub pages based.

For example, block is placed on page1 and outputs the content of page2, page3, page4

page1
-> page2
-> page3
-> page4

I'd prefer to do that logic in a controller and then pass to the view for output.

Thanks,
Paul

@tidyui
Copy link
Member

tidyui commented Oct 7, 2019

Hi there! The best way would probably to support an Init() method on blocks just like on fields, this would allow for encapsulating logic in the block itself.

@tidyui tidyui changed the title Block controller Add Init() methods to Blocks Jun 5, 2020
@tidyui tidyui changed the title Add Init() methods to Blocks Add Init() method to Blocks Jun 5, 2020
@tidyui tidyui added this to the Version 9.1 milestone Apr 4, 2021
@tidyui
Copy link
Member

tidyui commented Apr 4, 2021

Implemented in master

@tidyui tidyui closed this as completed Apr 4, 2021
@tidyui tidyui self-assigned this Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants