Solved

Drupal: HOw to recreate a function within a module so it won't be over written on update

Posted on 2014-02-04
2
21 Views
Last Modified: 2016-05-17
i had to make a change to one of the files in commerce_discount.  I added a join to the query so I could see another field in the product display.  I realized/remembered that should i need to update the commerce discount module, I will lose the changes I made.  I figure  I need to create/recreate the file with my changes, but how do I do this and call the new file and where do I store it so it will not be overwritten?

So for example, if I have made a change to coupon_discount.module, how do I recreate it?
0
Comment
Question by:quikwallace
2 Comments
 
LVL 13

Accepted Solution

by:
Arrow_1 earned 500 total points
ID: 39837485
Being that security, bugfix, and feature updates will be made to that file in the future, it probably wouldn't be wise to keep your original version of the file intact. That would result in missing out on these updates and potentially breaking the module all together following an update.

Your best bet would be to clone the module with Git so that source changes are tracked. That way you can create a local branch, then merge in the latest updates to the module, including those to the file you modified, while keeping your code changes intact.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scandir() not reads all files 4 26
Link SQL table to Webpage 9 39
php variable basic question 12 29
PHP string issue 5 18
Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now