OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – Programming Questions Bundle Inheritance – Access to other twigs

This topic contains 3 replies, has 2 voices, and was last updated by  ignat 8 years, 11 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #25031

    Brian Essig
    Participant

    I’m trying to create my own bundle…in the process I need to modify:

    \OroCRM\Bundle\ContactBundle\Resources\views\widget\info.html.twig

    I assumed I need to follow the instructions here: http://symfony.com/doc/current/cookbook/bundles/inheritance.html and added the following:

    Things seem to work, however later on I wanted to add a css file to assets.yml and was following instructions here: http://oroinc.com/orocrm/doc/current/book/layout#custom-css-files

    When I run php app/console assets:install and clear the cache I get a symfony error:

    Am I doing this best practice? Or is there an alternative way?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #25032

    ignat
    Participant

    Hi bessig,

    Check Controller directory in your bundle. It probably contains some controller class with your actions.

    Also check routing.yml file in OroCRMContactBundle: https://github.com/orocrm/crm/blob/master/src/OroCRM/Bundle/ContactBundle/Resources/config/oro/routing.yml#L1-L4

    After you have extended OroCRMContactBundle in Symfony is looking for routes configuration in directory of your child bundle (src/CD/Bundle/MsgBundle/Controller/). And it doesn’t found route for “orocrm_contact_create” there because it is located in parent bundle (src/OroCRM/Bundle/ContactBundle/Controller).

    This is default behavior of Symfony 2 so you need to configure routing.yml of your bundle to include all missed controllers in directory src/OroCRM/Bundle/ContactBundle/Controller.

    Another option is to extend all controllers in directory Controller of OroCRMContactBundle in your bundle. Even if child controller class will be empty, it will help Symfony 2 to load routes configuration properly.

    Thanks,
    Ignat

    #25033

    Brian Essig
    Participant

    Great! I took the extending the classes route. That seemed to have worked. ContactBundle has API\Rest and Api\Soap I did NOT extend these, and the front end seems to be working. As best practice, should I? Am I just waiting for trouble when there are ajax calls to the api?

    Additionally, as I go down this path, my end goal is to add a button next to the phone number on the contact/view/{id} page and then eventually also the grey contact box at /account/view/{id} and then lead/view/{id}

    It seems that going down this path I might have to extend 3 core bundles just to get access to put html in the twig. I’m thinking there must be an easier way. Ideally, I could add my html to the 3 twigs and then figure out the oro ui to fire off to my controller on click.

    I don’t want to spoil the idea of the plugin, but the behavior I am trying to get is when your on /lead/view/{id} and you click on more actions -> Log Call. A UI layer comes up with some fields, and fires to an api. So there is a button next to the phone number, if someone clicks that button, the ui layer comes up with some fields, and on pressing my “blue button” it gets fired to my method in the controller.

    I’m sorting through the Oro Docs and Symfony docs at the same time and this is my first Oro bundle, so if you can get me off to the right direction, I’d really appreciate it.

    Thanks,

    Brian

    #25034

    ignat
    Participant

    Hi Brian,

    > That seemed to have worked. ContactBundle has API\Rest and Api\Soap I did NOT extend these, and the front end seems to be working. As best practice, should I?
    No, you don’t. It should be enough.

    > It seems that going down this path I might have to extend 3 core bundles just to get access to put html in the twig.
    Did you consider “placeholders”? Check this http://oroinc.com/orocrm/doc/current/book/customization. And this https://www.youtube.com/watch?v=Kokec9KFrmE&t=2h41m12s.

    Thanks,
    Ignat

Viewing 3 replies - 1 through 3 (of 3 total)

The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.

Back to top