Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
51 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
Aaron Feledy earned 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

636 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