override of page save.php in actions\widgets

Hello everyone, I need to do an override of the page
save.php allocated in the "actions \ widgets".

I want to make sure that when I need to change the line
get_input $ params = ('params');
in
get_input $ params = ('params', NULL, false);

so that I can for example make a map of GoogleMaps.

How can I do? Thanks to all

PS Sorry for bad English

  • In elgg 1.8, you can either

    • Use elgg_unregister_action() and unregister the existing action and then register your action instead
    • Or you can extend the action with a plugin hook for that action.

    There has been a discussion few days back on how to extend actions. Look in the discussion topics of last week.

  • Hello, thanks for the answer.
    I have a doubt.
    I refer to the page that I was the Edit.php \ Pluing your widgets.

    Where in the frontend add parameters to the widgets.

    I saw save.php modified but they are all at the level of specificcontent or form, I have not found any example that changes the pagesave.php Edit.php because that button is built into elgg.

    Can you say the same? I'd say x a courtesy.
    Thanks again and sorry for my english

  • in my page start.php i have insert this code

     

     

    $action_base = elgg_get_plugins_path() . 'includeGoogleMaps/views/default/widgets/includeGoogleMaps/';

    elgg_register_action('widgets/includeGoogleMaps', "$action_base/save.php");

     

    but 

    however, continues to work with the page save.php in actions /widgets /.

     

  • where is the form being called?  You have to change the action on the form for it to use your custom action.  Or, you need to unregister the existing action and replace it with your own of the same name.

    Also, your action is in the wrong place.

    You registered "includeGoogleMaps/views/default/widgets/includeGoogleMaps/save.php"

    Action files should be in the action directory

    "includeGoogleMaps/actions/widgets/includeGoogleMaps/save.php"

  • Widget is an ElggObject. Any setting you pass to it is simply saved as metadata.

    edit.php is a form that wraps such metadata input. It is then passed to save.php, whereas each input field is saved as $entity->input_name.

    It would be quite unsafe to expose input fields the way you want to, so I would suggest to look for an alternative solutions. I suppose the base url for the maps stays same, so you could perhaps just append a plugin setting to the tags in a widget content view.

    If you decide to proceed with your initial plan, then just create a plugin hook for 'widget_settings', $handler. see. ElggWidget class for reference

  • a regular user, go on Google and you copy the contents of the box"Paste HTML to embed in website" certainly does not make themtake the piece they need.
    Why I wanted to plug in my face that he is copying and pasting.
    Now maybe I look to find an other way:)

  • when the value placed on the page of Edit.php comes to the "public function SaveSettings ($ params)"
    the value in $ params has already been cleared.
    Why is called the first page
    elgg / actions / widgets / save.php
    and after the function, so the problem remains ... is the functionwithin save.php (get_input ('params');) tag_filter that option.

    solution is to edit this page and

    switch (strtoupper ($ _REQUEST ['params'] ['nameplugin'])) {
         houses strtoupper ('includeGoogleMaps'):
            get_input $ params = ('params', null, false);
             break;
         default:
            get_input $ params = ('params');
             break;
    }

    But I tried another method