Snippet overwrite media files?

I’m looking for a snippet that will overwrite media files. Example: There a audio file called Dogpark.mp3 uploaded to wordpress. The next week I have a few file called Dogpark.mp3 which I want to upload and replace last weeks file. Is there a snippet library I can find snippet that does that? The client doesn’t want to use media replacement plugin. Thank you for your time.

magento2.3 – overwrite form.phtml to customize the contact form?

I call up the contact form on my CMS page as follows (as follows):

{{block class="MagentoContactBlockContactForm"
 name="contactForm" template="Magento_Contact::form.phtml"}}

I have duplicated:


and put it in my theme folder:

app/design/frontend/(vendor)/(my Theme)/Magento_Contact/templates/form.phtml

Caches cleared, but the form is still pulled from the core. Have I missed a step?

magento2 – How do I overwrite magento-sales / CustomerData / LastOrderedItems.php?

I have created the following files below, but the default LastOrderedItems.php file is not overwritten

Does anyone know what I did wrong or should I have done differently?

app / code / MySite / ModuleSales / etc / di.xml


app / code / MySite / ModuleSales / etc / module.xml


app / code / MySite / ModuleSales / registration.php

app / code / MySite / ModuleSales / CustomerData / LastOrderedItems.php

magento2.3 – Overwrite a parent topic in the provider with a child topic in the Magento 2.3 app

I made a subject that is a child a custom theme that is a child of Luma.

My topic lives in:


My subjects parents live in:


The parent overwrites:

Magento_Catalog/templates/product/view/gallery.phtml among others as follows:


I want to overwrite this override, but I don't seem to be able to set the directory structure of my child topic properly, or I'm missing something else.

My first thought is to create it like this:


But that doesn't seem to work. gallery.phtml is still loaded by the parent element. I tried a few combinations of the directory structure with no luck. How do I overwrite the overwrite?

magento2 – Overwrite Magento Catalog Model Product Type Price – Magento Stack Exchange

I implement the product price calculation based on a formula that uses customizable options in Magento 2 (version 2.3.1). I added _applyOptionsPrice () code to "Magento / Catalog / Model / Product / Type / Price.php" and it works like magic. Now I want to remove my code from Magento code and implement it as a custom module. but as much as I try, I can't get it to work as it is believed.

Here is my code:

in app / code / ABPPRK / ModulePrice / registration.php:

in app / code / ABPPRK / ModulePrice / etc / di.xml:




And finally app / code / ABPPRK / ModulePrice / Model / Price.php:

Of course, the return of the method to be overwritten (getFinalPrice) should not be this. This is just a simple implementation for testing with xdebug that doesn't work because neither the real code.

There are no errors during "bin / magento setup: di: compile". And I can say that the command is considering my module because at some point it issued the error:

"Warning: The declaration of ABPPRK ModulePrice Model Price :: getFinalPrice () should be compatible with Magento Catalog Model Product Type Price :: getFinalPrice ($ qty, $ product)."

What is missing here? I've followed all of the tutorials I've found for overriding class methods, but I haven't found anyone specific to that method. 🙁

Thanks in advance,

physical – overwrite iPhone data

How long does it take for iPhone 7 (iOS 12.2) to overwrite the data of recently deleted photos / videos?

Does this happen immediately after I take another photo / video (the new photo replaces the data pointer of the deleted one and the deleted one is now not recoverable?) Or does it take months?

Thank you so much!

magento2.3 – Magento2 How do I overwrite the manufacturer of the PHP file / magento / module-customer / Model / Vat.php in a custom module? VAT check error

How can I overwrite this PHP file?
Manufacturer / Magento / module customer / model / Vat.php
I want to change it




How can I do that in my custom module?

Overwrite text if you click the button several times.


I have buttons ("+") (green) for different sections. When I click one of these buttons, I open an input field and a text field. Finally, the data from both fields should be placed in a database with the foreign key of each section.


I show the section text in the caption field label so the user knows which sections the new input data belongs to.

This works fine, but every time you click a "+" button, new text is added, but the old text is not removed. How can I remove the old text and add the new one?

Here is the function:


        newCpId = $(this).parent(this).attr('id');

       $('label.headlineNewCp').before(' for ' + $(this).siblings('span').text() + ', ');

       $('#newCP').on('click', function() {
          //....for db                

Code (JavaScript):

Thanks, people!

Can you overwrite individual submission forms?

I have a form that generates some custom financial reports (can't use views). It contains some typical form elements, a table or results, and submit buttons: Submit, Reset, and Download.

Send and reset do what you think. Download triggers a submit handler that creates a CSV from the $form('table') in the handler (which was generated by the user and prevents another complicated database query) and then spits it out with a $form_state->setResponse($response). It works great.

During testing, however, I discovered an interesting marginal case.

core / misc / form.es6.js contains a section of code (lines 117-134 in Drupal 8.8.5):

Drupal.behaviors.formSingleSubmit = {
  attach() {
    function onFormSubmit(e) {
      const $form = $(e.currentTarget);
      const formValues = $form.serialize();
      const previousValues = $form.attr('data-drupal-form-submit-last');
      if (previousValues === formValues) {
      } else {
        $form.attr('data-drupal-form-submit-last', formValues);

      .on('submit.singleSubmit', 'form:not((method~="GET"))', onFormSubmit);

This prevents a form from being sent multiple times if it has not been modified. However, since my download button is a submit handler, the code above is executed that prevents the reset button from working unless another form element has been changed.

My current workaround is a sledgehammer:

Drupal.behaviors.monkeyPatch1 = {
  attach: function (context, settings) {
    $('', context).on('submit', function (e) {
      var $form = $(e.currentTarget);

As far as I can tell, this works, but I activated BigPipe and go to AJAX to improve the form a little. So I'm worried that this could be fragile.

Is there a JS API method to disable single submit behavior or is a workaround the only solution?