Hook the function in module in Drupal - drupal-6

How can I make changes to the function uc_order_view_update_form($form_state, $order)? This exists in ubercart\uc_order\uc_order.order_pane.inc. I dont know how to make hook for this function.

You can safely modify any form in Drupal from a custom module using hook_form_alter.

Related

Reusing a component in lit-element

Anyone that can point to any documentation on howto reuse code in lit-element.
The problem now is that if I declare an element, in my case a close-button and I want to reuse it by importing it into 2 or more lit-elements, there will be an error in the browser about the close-button being declared more than once.
Understandable enough, but how do I reuse a component, I could of course move the button to a separate file and add it to the document, but then there would be dependencies on that for other components to work.
Any suggestions
If close-button self-registers itself, with a call to customElements.define('close-button', ...), then you should be able to import its defining module and not have any errors due to the module caching behavior of JS.
You must have multiple customElements.define('close-button', ...) calls, so I'd make sure that 1) it's self-registering and you're not registering it again in each component that uses it, and 2) you're using standard JS modules.
After investigating a bit more, I concluded that sharing HTML templates might be the way to do it.

Prestashop 1.7 hookActionObjectCustomerUpdateBefore and after

So, I'm wondering why if I put a variable (public) in the hook hookActionObjectCustomerUpdateBefore and read it, then in the hook hookActionObjectCustomerUpdateAfter I lose it. Even if I assign it as smarty variable.
I'm running these hooks from a module and in backend.
Thanks for your tips.
To add a public variable on Customer class, you should override this class and add your custom variable. then you can use it every where on PrestaShop.
You can't use "action hooks" to add new definitions to PrestaShop. these hooks are made just for the actions.

Require.js: "Mismatched anonymous define() module" error

I'm developing a JavaScript plugin for webshops which is module based and I'm using require.js as module loader to integrate it into the customer's HTML template.
The idea behind that is to let the customer put only one line of code into their template and everything is loaded automatically.
I get problems when the webshop has third party scripts which define themself anonymously as AMD module but are included by a separate <script> tag. In this case I get errors like:
Uncaught Error: Mismatched anonymous define() module:
[..]
http://requirejs.org/docs/errors.html#mismatch
There is no way to me to take influence on that. It is also not possible for me to influence where in the template my one-liner is put by our customers.
Is there a way to tell require.js to just focus on the modules I name in my code and to ignore any other referenced module-define JavaScripts?
I had the same problem. My workaround has been to put all the require/define/requirejs objects under another object such as foo.require, foo.define, foo.requirjs. I've now found in the require page something like what I did:
http://requirejs.org/docs/faq-advanced.html
Hope this can help you!

Snap: Heist templates path

How can I change the default templates path?
The initialization function takes path relative to "projectroot/snaplets/heist"
Which is heistInit "templates". So I end up with templates located in "projectroot/snaplets/heist/templates"
I would like my templates in "projectroot/resources/templates" instead.
Is this possible? How do I pass it to the initializer?
Thanks
You can't. Snaplets have to use that directory hierarchy otherwise they won't be fully composable...i.e. what would happen if your app was sub-snaplet of another application. When we first released snaplets, we actually did it the way that you're asking for here. It seemed fine until we tried more complex snaplet hierarchies. If you want to simplify the default as much as possible, you can use heistInit "", which will as you noted store your templates in snaplets/heist.
If you REALLY want to put your templates there, you could add that to the Heist snaplet as another template location using the function addTemplatesAt. But you can't prevent the Heist snaplet's initializer from also looking in snaplets/heist.

Make Google Custom Search look at GET parameters

I have a Google Custom Search snippet in a page, say search.php and it seems to work fine if I use it from that page.
However, I'd need to somehow make it recognize GET arguments, so that for instance if I loaded search.php?q=test, it would directly search for test.
Is there a way to make it do that?
I found I can use CustomSearchControl's execute method.

Resources