Results 1 to 3 of 3

Thread: prepareForWidget - overriding DCA's options/options_callback

  1. #1
    New user
    Join Date
    07-01-10.
    Location
    Midlands, UK
    Posts
    26

    Default prepareForWidget - overriding DCA's options/options_callback

    Hi

    I am writing a fairly sizable extension, having built the backend logic/display etc but I have come up against a hurdle with the prepareForWidget() method when building the frontend. I have some form fields I would like to render, some of which are of the 'select' type, for which, I need to have an options list generated. I am ok with implimenting either ['field']['options'] or ['field']['options_callbacks'] as necessary (as I've done so in the backend). Options is no good as the data is in the database so I figured using 'options_callback' was the way to go, but in this case, I have a variable that is available in my frontend module (class MyModule extends Module) which is required to get the correct data from the database when using the options_callback. I should say that a number of the methods provided by my module are provided from other classes I have written, extending Model, Controller, Frontend. The only class that the variable is available is is the 'class MyModule extends Module' class - I have to confess to being a bit n00bish when it comes to OOP, learning as I go and this issue undoubtedly stepms from my limited OOP knowledge.

    Any help would be gratefully accepted though as to how I get my variable into another class :-)

  2. #2
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: prepareForWidget - overriding DCA's options/options_call

    You can call an object directly without direct inheritance.

    Use this structure:

    Code:
    myFEModuleName::mymethod(param, param);

  3. #3
    New user
    Join Date
    07-01-10.
    Location
    Midlands, UK
    Posts
    26

    Default Re: prepareForWidget - overriding DCA's options/options_call

    Thanks for this thyon. I've managed to achieve what I wished with this and implemented the date picker in my frontend forms too, which is a bonus :D

    I do have another question with regard to the widget class. I have a collection of forms, split over a number of pages. Each form is assembled from the db (according to the config setup in the backend) and consists of a number of fields. I should stress this isn't using the forms module at any point, it is a completely custom module. I would like to be able to duplicate and/or control the number of field-sets appearing on some of the forms (similar to how this works in the backend with adding new table rows or module positions in the layout section etc). So a user clicks an add button and another group of fields appears (ideally with a limit number of sets available) or output a number of field-sets at page load time. The forms are saving to $_SESSION until we get to the end.

    Any insight that anybody might have on this would be much appreciated .

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •