How to make custom Composer possible on custom page types?

Permalink
Hey guys!

so... i'm a concrete5 newbie and i have a custom page type with the handle "news".

When creating a new page with this pagetype, the composer opens and there are some textinput fields which i defined.

So i figured, it would be great if i could do some own stuff. My question:
1.) How can i insert javascript code into the composer only for the page type "news"?
2.) Can i do some stuff with the data which the user types into the composer before it will be saved to the db (validation etc)?

I've read the documentary and stumbled across this:
https://www.concrete5.org/documentation/developers/5.7/working-with-...

So i did something like (not the actual code):
<?php
namespace Application\Controller\PageType;
use Concrete\Core\Page\Controller\PageController
class News extends PageController
{
    public function view()
    {
          doSomeStuff();
    }
    #not sure about that composer() method even exists
    public function composer()
    {
          registerMyJavascriptAssets();
    }
}


But this doesn't seem to work. when opening the composer of these pages with the pagetype "news", nothing happens.

Anyone can help? Thank you in advance :)

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi s0krates,

I am also interested in this topic.
s0krates replied on at Permalink Reply
Seems like we are the only two dudes who are interested in that topic :)
WebcentricLtd replied on at Permalink Reply
I'm very interested in this but have not had the chance to have a look into it yet.
Hopefully when I get a couple of hours I'll be able to look.

If you find anything new out though - please share...
MrKDilkington replied on at Permalink Reply
MrKDilkington
A core team member recommended this:
"fire an event from \Concrete\Controller\Panel\Detail\Page\Composer::view"

This helps point to a direction of a possible answer. I need to do a follow up because I am unsure about how to use the information.

I only see one event that is related to Composer - on_page_type_save_composer_form.

I am not sure if a new event needs to be created for this.
WebcentricLtd replied on at Permalink Reply
good info. I've only had a couple of mins and can't investigate until some later point. But the interesting stuff all seems to be under:

concrete/src/page/type/composer
s0krates replied on at Permalink Reply
that sounds good. I've read in the documentary that it is possible to create custom events, so it should be possible to create one and fire it from there if i'm not mistaken. Unfortunatly i have to work on other tasks for the moment so i can't try. But definitly will test this, thanks!