Difference between Module and Component in Joomla - php

Can somebody please tell me what is the basic difference between the module and component in Joomla?
If possible, please tell with some examples, so that it is easily understood.

Modules are usually small pieces of functionality designed to _present information in your site). They can appear a number of times, on a number of pages in various positions.
On the other hand, a component is typically more complex, with extensive functionality and capabilities. A component can only be displayed in the main area of a page, and can usually only be displayed in a single page.
Read this article for more info:
http://www.dart-creations.com/joomla/joomla-tutorials/the-difference-between-modules-and-components.html

Taken from http://forum.joomla.org/viewtopic.php?t=344599#p1485432 by David Hurley.
When I'm working with clients here is how I typically explain the differences.
A plugin will manipulate output already generated by the system. It typically does not run as a stand-alone piece, but takes data from other sources (i.e. the content) and manipulates it before outputting to the user window. A plugin typically does not display directly to a user, but does its work behind the scenes.
A module is typically considered to be an add-on to the site that extends the functionality of another part of the system. It usually has fewer options that are configurable by the end user and most of the time does not handle any storing of information into the database. A module usually occupies a secondary portion of the web page and is not considered the primary focus of a page.
A component is the most extensive add-on. This typically adds completely new, or different, functionality to your site and extends the overall site possibilities. A component handles data manipulation as well as input and storage into the database. A component on most sites occupies the main area of the website layout and is the primary focus of the page.
These are just generalizations and there are exceptions to every rule, but this should give you a good starting point.

As far as I can see, any reason for distinguishing between components and modules is hidden in the technique of the Joomla framework. The fact that the main editorial content of a page is provided by a component, whereas subsidiary information (side frames, headers and footers, etc.) are provided by modules is not a real difference as far as the user is concerned. Page content is page content - full stop!
I think it is misleading to confuse users by stressing this difference. The way modules associate with menu items is probably technically different to the way the components do. Components are associated with a page on a one to one basis and they are run by triggering a menu item. Also modules do not always need to access the database whereas this is an integral part of a component. I expect these technical differences ultimately explain why Joomla has built the distinction in the the user interface. Perhaps avoiding this distinction would be the basis for Joomla version 4 - but I suspect this would mean starting from scratch with a totally new CMS :(

A component always displays its results in the "mainbody" area of your template.
A module displays its results outside of the "mainbody" ... usually along the side, top, or bottom of the mainbody.

Related

Converting PHP site to Joomla

I have a large complex web site currently implemented using PHP and MySQL.
Some of the pages (about, contact us, etc) are largely static, but need to be updated from time to time. I'd like these updates to be able to be done by non technical admins, so I'm migrating the site to Joomla CMS. I've created a Joomla template to reproduce the banners, styling etc of my existing web site and have successfully reproduced the static pages by cutting and pasting into Joomla articles.
I'm now trying to embed my existing dyanamic php pages into the Joomla framework. I assume that I need to convert them into one or more Joomla components? I realize that I'll need to strip out the php code that currently generates banners, menus, etc, but I don't want to make major changes to these php pages, i.e. I don't want to re-implement them to follow an MVC pattern. I'm looking for a simple Joomla 3.2 hello world component tutorial. The tutorials that I've found are either too complex (i.e. MVC) or they're "too simple". By too simple I mean the component is not listed when I select Menu Item Type within the Menu Manager. Can anyone point me to any documentation that explains the minimal config that I need to include in a custom Joomla 3.2 component in order for the component to be listed when selecting Menu Item Type?
Also, should I create one big custom component to wrap my existing PHP application containing multiple pages("views"?)? Conceptually there the system could be considered as about 3 sub-systems, but there is some overlap between the MySQL tables used in these different sub-systems.
I don't need the implementation to be portable, i.e. I'm not trying to create a reusable component that others could use, I just need it to work on my site, using the least amount of work possible.
Thanks, Wayne.
I hope to clarify a bit and give you way out.
In response to your comment on #user3057084, the power of Joomla and its flexibility comes from it being MVC! If you want to wrap your existing code with little modifications, Wordpress will let you do all kind of nasty things! Nasty in the sense of mixing logic with data, i.e. copying and pasting your code and getting it to work quickly.
Joomla coding standards require that you separate models from views. And that you understand how the Joomla MVC implementation works. It will take longer, but you'll learn a useful skill that can and should be applied if you want to write portable maintainable code following Design Patterns.
Now about the way out.
Nothing keeps you from putting your raw php code in a Joomla view, including the database access. It's really ugly and I feel bad even suggesting this, but if it can be a small step towards using a great framework, then the end justifies the means.
The absolute easiest way for you in Joomla would be to create a template override (which you'll do from the admin with a few clicks in the template manager), then throw your code in, and it will run. Then, a little bit at a time, you might learn to separate the parsing of the input in the controller, store / retrieve the data in a model, and leave just the markup in the view.
But are you absolutely sure you need to code for this? There are thousands of (free) extensions out there that might do the job for you with no coding and little configuration, leaving you just a data migration to handle.
Have you had a look at Wordpress yet? In my experience, non-technical people find it easier to administer a wordpress website in comparison to a Joomla website.
When it comes to the menu structures,themes and contact forms and blogs - Wordpress takes the cake.
It would be worth your while to check it out? It might save you hours of frustration?

Joomla: What is a good technical approach for data entry?

I have a background in .NET and Perl, but have found myself working on a project where the customer is mandating Joomla. They would like me to setup a web site that will allow them to enter rental properties, which would likely include a large description field and a number of smaller metadata fields. What is a good way to approach this problem using Joomla? Would I somehow add metadata fields to articles for entry of rental properties? Would I need to create something outside the realm of an article (I'm thinking maybe a component, based on some intro training videos that I have watched on Joomla)?
My HTML and CSS skills are pretty solid, and I have a little bit of experience with PHP, so I don't mind getting my hands dirty. However, I'd like to get an idea of how a Joomla veteran would approach the problem.
Trying to tack meta information on to the articles is almost certainly not the way to go - for a ton of reasons. You are on the right track with a component. Consider designing a component with a back-end database, admin capability and a few front-end data-entry/information screens. The Joomla framework is a little cumbersome to begin with, but ultimately the MVC implementation makes sense and is quite powerful.
This tutorial at the Joomla documentation wiki runs through pretty much everything you need to know from a basic "hello world" to databases and more complex implementations. It sounds like the basic database-enabled example would get you really close to your objective. The example application builds on itself from one tutorial to the next, so it is not at all a waste to start at the beginning and work through it.
And a couple random bits of advice for a Joomla component development beginner:
One thing you may want to research related to data-entry is the JHTML class (the JHTML::_() function in particular). IMO the approach is less than intuitive, but using it is required to leverage built-in widget classes defined for the standard form fields in more advanced applications. It is also important for working with customized form field types and handlers.
Also, the objects returned by JFactory::getApplication() and JFactory::getDocument() have a ton of useful/important functionality when it comes to manipulating the Joomla application (like access to the JInput object). Get familiar with what they can do and remember how to retrieve them.
Good luck.
While building a component from scratch is the most flexible the initial learning curve might be too expensive (time wise) if you're not experienced with PHP and the Joomla framework.
Generally, if we're asked to do something outside our normal areas in Joomla the first place I look is the Joomla Extension Directory (JED).
From that I can usually find a very good solution or a very near match. If it's not a perfect match I can easily extend it (e.g. adding a plugin for a local payment gateway) or work with the developer to add the features we need to the extensions core). Which is probably a good way to start with Joomla, i.e. modifying or extending an existing extension.
You're lucky though, the area you're interested in has it's own category on the JED — the Real Estate section has 15 items listed and most them seem to have good ratings and reviews.
So, I'd start there.
You could make a form plugin for articles to add the extra field or to divide the body field into sections with json or using the profile plugin as a model you could add fields and store them in a separate table.
YOu could repurpose the contact component and use its many fields, or just clone it and change the names.
You could also use an advanced form extension.

Creating admin menu items dynamically in joomla

Another day playing around with joomla, and another shortcoming to fix :)
This time it comes in the form of the administration(backend) menu.
To add items/subitems to this menu, people have to write the menu items in an xml file accompanying their components/extension/plugin/whatever.
When the extension is installed, joomla "generates" the menu items and "stores" them in the DB.
Effectively, the real/tangible menu is rendered by reading the DB.
This has several implications:
The menu is not scriptable
The menu is not dynamic; changing the XML file after installation, won't update the menu
Removal of items is not scriptable; joomla takes care of removing any items when you uninstall the extension.
I've got this system which relies on the ability to modify menu items on the fly, but through code.
Simply put, I need to have functionality where I can create a volatile menu item (ie, it gets removed at the end of session).
To do so, I've got a couple of prospective hacks:
Override the joomla global database instance so that I can make it return fake menu items. This is possible since the database object is stored in a public property of JFactory class: JFactory::$database=new MyFakeJDatabase(JFactory::$database);
Intercept the menu code (html) before being output and mess it up according to my needs. This is not template-friendly in that the end result would be injecting html, which might not be what the template was designed for.
Create menu items through javascript. This suffers issues with the template AND the javascript that toggles submenus.
Create menu items in the DB whenever I need them and somehow "tag" my items so that I remove them the next time (or end of session). This sounds like it would work like a charm. Since I can buffer menu items, I could possibly create my menu items in one whole SQL statement. Than I could use another SQL to remove the tagged menu items. 2 SQL statements might not be much of a load on the server.
What do you think?
Edit: I've checked joomla/administrator/modules/mod_menu/helper.php to see if I could find a way to inject my stuff, wishing that maybe joomla used a global variable or something, but to no use - the menu items are creating directly by reading the db and rendering as well.
FYI I've searched a while on Google, to no use.
Interesting. I have worked with Joomla for many years, writing all kinds of extensions for various purposes, including integrating external systems. It has been my experience to approach these types of situations by looking at the basic needs of code execution. And I always seem to start off asking: is it UI driven or system-driven?
First, consider if the code will execute according to user-generated system events. There are a whole bunch of 'em and you can even trigger your own. If this is a requirement, then the solution will need to incorporate a plugin, attached to events.
However, for any kind of dynamic UI content, you will need a module. Modules are all about displaying content. These guys are designed for the user experience. So, consider how access to the UI content will be managed. Which users will comprise the "audience" of this content? This is controlled by user groups and access levels. At some point in your code, preferably early, you will have to check the user's rights and then modify your code execution in response. Thankfully, I find that someone has already done a lot of the work for me. How?
Find an extension that performs the things that your code needs to do, or as close as one might match up. The entire CMS is built with extensions running atop the Joomla! Framework and there are thousands of extensions available for download. Once you've found it, clone the thing. Then edit it so that it does what you need it to do, plus what it did before (if that is a requirement). Install your updated clone, unpublish the original and publish yours. Saves a lot of time.
Looking at your requirements, the code only executes as long as there is a session. I would start with with a 'user' type plugin. When the user triggers a login event the plugin can add the dynamic menu records to a session variable as an array of db records. When the user triggers a logout or the session times-out, the records will go away by themselves. Then I would simply clone "mod_menu" and have read in any records that it finds in the users session. I use this session variable technique all the time, especially when implementing analytic data gathering stuff.
Anyway, I don't post often; but I sure hope this helps. I would love to see this type pf functionality myself. Just haven't the time to code it.
Good luck!
chozyn
The "correct" way would be to write a module which overrides the core menu module to achieve the old functionality with the added feature of dynamic menus from whatever source you have. Not particularly a nice way to go, but that is Joomla's way.
Thanks to #ircmaxell to point this method out.
No hack seems satifactory, safe or maintainable enough to achieve this.
I've aborted the project and instead am putting buttons in the main dashboard through JS.
It's highly inconvenient to end users (they still miss sub-items). But what the hell...it's Joomla's fault.
Oh and for the record, I needed to add my own custom "pages" similar to admin components. Guess what? That failed as well, so it's another hack.
Hope that by version 1.7, they[joomla] trash the initial codebase altogether.

Drupal & Regular PHP Integration

I'm building a new website which has one core application and many content pages. Content pages are mostly dynamic and I require a way to manage this dynamic content on a regular basis. The core application's main functionality is a 3 step process or reading user data (input page), reading data from MySQL (product page) and submitting an application to an email address (application page).
Ideally I would like to build the core application in regular PHP and leverage Drupal for its content management capabilities. Can Drupal and regular PHP be integrated as I suggest easily? My feeling is that coding the core application as a Drupal module(s) will add layers of complexity that could be difficult to code from the outset and maintain later on as the system matures - so I would really like to just use regular PHP.
Let me explain where dynamic content (managed by the CMS) intersects with the core application:
Dynamic content such as FAQ data is used both on the 'normal' help pages and also within a mini-feed displayed within core application pages down a right hand side column. In this column, 3 random questions are pulled from the database and displayed as a feed. When users click on FAQ question they are not taken away from the core application product page but are instead shown data in a pop-up window displaying the question and answer. In addition, users can browse other questions and answers through a simple navigation menu within this popup. There are 3 such like feeds as I describe above that I require on the core application product page.
So, what is the ideal solution here in terms of 'keeping things simple' for both the management of dynamic content and the ease of coding the core application? Can 'regular PHP' and Drupal co-exist 'peacefully'? If so, how is this technically possible? Because there is some content managed by Drupal contained within core application pages, can the core application still be coded in regular PHP?
Any advice / suggestions?
Thank you!
Jim.
This is part of a post I submitted few years ago. Unfortunately the linked article is long gone, but it might still be relevant for your needs:
Importing old-style standalone PHP scripts into Drupal system
Drupal system is a very strong CMS, but taking an existing PHP site and trying to force it on Drupal might be a hard thing to do.
The "right" way to convert a site into Drupal is to "Drupalize" it, which means to do everything "the Drupal way", which is really the right thing to do - but is some cases not everybody agrees about that.
I had an example with a company that has many HTML/PHP based sites. They heard about the flexibility and strength of Drupal, and decided it is their choice for the revolution. But, on the other hand, they want not to change anything, and that I will do it as fast as possible.
The "right way" to do it was to break each PHP script they have to its pieces, find the commons, create the right methodology with existing Drupal modules, and finish the gaps with my own additional module.
But this is not what they asked me to do - instead, I looked for a way to just import the existing PHP script into Drupal environment.
Searching for am existing solution brought me to a proof-of-concept described by Dan Morrison. In the bottom line it uses PHP output buffering commands it order to collect everything the old script does, and then to display it as part of a Drupal module. In my case I had to make some small modifications (mainly to pass variables from the request to the PHP in the relevant scope), but in the bottom line it did exactly what I needed.
Well, almost... In other cases, in which I wanted to enjoy from Drupal's Form API, I handled it differently, as I will describe later on.
It sounds like you are asking about two things:
Including Drupal content in a custom-built PHP application.
Displaying Drupal content in a pop-up window from the PHP application.
There are a number of different levels of integration- if your need is as simple as pulling content into a page then you may be able to simply create a view (http://drupal.org/project/views) with that content from Drupal that you can make available to and then include it in your web app.
If you are looking for a tighter integration between the 2 including sharing of users, sessions, etc... then it is likely also "possible" but would take additional information to understand what you need.

How Drupal works? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Could someone provide a architectural overview of the Drupal 7 control flow? Perhaps in the sense of a flowchart about how a page gets generated. What additional resources would you suggest consulting with regards to how Drupal works?
Drupal can be confusing on this front, partially because it has a relatively deep function stack. Although it's procedural PHP it's purely event/listener driven in its architecture, and there's no simple "flow" in the main PHP script for you to look though. I recently did a presentation on this very subject, and the slides are posted on slideshare, but a quick high-level summary may be useful.
Drupal's index.php file functions as a frontside controller. All page are piped through it, and the "actual" url/path the user requested is passed to index.php as a parameter.
Drupal's path router system (MenuAPI) is used to match the requested path to a given plugin module. That plugin module is responsible for building the "primary content" of the page.
Once the primary page content is built, index.php calls theme('page', $content), which hands off the content to Drupal's theming/skinning system. There, it's wrapped in sidebars/headers/widgets/etc..
The rendered page is then handed back to apache and it gets sent back to the user's browser.
During that entire process, Drupal and third-party plugin modules are firing off events, and listening for them to respond. Drupal calls this the 'hook' system, and it's implemented using function naming conventions. The 'blog' module, for example, can intercept 'user' related by implementing a function named blog_user(). In Drupal parlance, that's called hook_user().
It's a bit clunky, but due to a PHP quirk (it keeps an internal hashtable of all loaded functions), it allows Drupal to quickly check for listeners just by iterating over a list of installed plugins. For each plugin it can call function_exists() on the appropriately named pattern, and call the function if it exists. ("I'm firing the 'login' event. Does 'mymodule_login' function exist? I'll call it. Does 'yourmodule_login' exist? No? How about 'nextmodule_login'?" etc.) Again, a touch clunky but it works pretty well.
Everything that happens in Drupal happens because of one of those events being fired. The MenuAPI only knows about what urls/paths are handled by different plugin modules because it fires the 'menu' event (hook_menu) and gathers up all the metadata plugin modules respond with. ("I'll take care of the url 'news/recent', and here's the function to call when that page needs to be built...") Content only gets saved because Drupal's FormAPI is responsible for building a page, and fires the 'a form was submitted' event for a module to respond to. Hourly maintenance happens because hook_cron() is triggered, and any module with mymodulename_cron() as a function name will have its function called.
Everything else is ultimately just details -- important details, but variations on that theme. index.php is the controller, the menu system determins what the "current page" is, and lots of events get fired in the process of building that page. Plugin modules can hook into those events and change the workflow/supply additional information/etc. That's also part of the reason so many Drupal resources focus on making modules. Without modules, Drupal doesn't actually DO anything other than say, 'Someone asked for a page! Does it exist? No? OK, I'll serve up a 404.'
To understand how Drupal works, you need to understand Drupal's page serving mechanism.
In short, all the calls/urls/requests are served by index.php which loads Drupal by including various include files/modules and then calling the appropriate function, defined in module, to serve the request/url.
Here is the extract from the book, Pro Drupal Development, which explains the Drupal's bootstrap process,
The Bootstrap Process
Drupal bootstraps itself on every request by going through a series of bootstrap phases. These phases are defined in bootstrap.inc and proceed as described in the following sections.
Initialize Configuration
This phase populates Drupal’s internal configuration array and establishes the base URL
($base_url) of the site. The settings.php file is parsed via include_once(), and any variable or string overrides established there are applied. See the “Variable Overrides” and “String Overrides” sections of the file sites/all/default/default.settings.php for details.
Early Page Cache
In situations requiring a high level of scalability, a caching system may need to be
invoked before a database connection is even attempted. The early page cache phase lets
you include (with include()) a PHP file containing a function called page_cache_
fastpath(), which takes over and returns content to the browser. The early page cache
is enabled by setting the page_cache_fastpath variable to TRUE, and the file to be included
is defined by setting the cache_inc variable to the file’s path. See the chapter on caching
for an example.
Initialize Database
During the database phase, the type of database is determined, and an initial connection is
made that will be used for database queries.
Hostname/IP-Based Access Control
Drupal allows the banning of hosts on a per-hostname/IP address basis. In the access control
phase, a quick check is made to see if the request is coming from a banned host; if so,
access is denied.
Initialize Session Handling
Drupal takes advantage of PHP’s built-in session handling but overrides some of the handlers
with its own to implement database-backed session handling. Sessions are initialized
or reestablished in the session phase. The global $user object representing the current user
is also initialized here, though for efficiency not all properties are available (they are added by an explicit call to the user_load() function when needed).
Late Page Cache
In the late page cache phase, Drupal loads enough supporting code to determine whether or
not to serve a page from the page cache. This includes merging settings from the database into the array that was created during the initialize configuration phase and loading or parsing module code. If the session indicates that the request was issued by an anonymous user and page caching is enabled, the page is returned from the cache and execution stops.
Language Determination
At the language determination phase, Drupal’s multilingual support is initialized and a decision is made as to which language will be used to serve the current page based on site and user settings. Drupal supports several alternatives for determining language support, such as path prefix and domain-level language negotiation.
Path
At the path phase, code that handles paths and path aliasing is loaded. This phase enables
human-readable URLs to be resolved and handles internal Drupal path caching and
lookups.
Full
This phase completes the bootstrap process by loading a library of common functions, theme
support, and support for callback mapping, file handling, Unicode, PHP image toolkits, form
creation and processing, mail handling, automatically sortable tables, and result set paging. Drupal’s custom error handler is set, and all enabled modules are loaded. Finally, Drupal fires the init hook, so that modules have an opportunity to be notified before official processing of the request begins.
Once Drupal has completed bootstrapping, all components of the framework are available.
It is time to take the browser’s request and hand it off to the PHP function that will
handle it. The mapping between URLs and functions that handle them is accomplished using
a callback registry that takes care of both URL mapping and access control. Modules register
their callbacks using the menu hook (for more details, see Chapter 4).
When Drupal has determined that there exists a callback to which the URL of the browser
request successfully maps and that the user has permission to access that callback, control is handed to the callback function.
Processing a Request
The callback function does whatever work is required to process and accumulate data needed to fulfill the request. For example, if a request for content such as http://example.com/
q=node/3 is received, the URL is mapped to the function node_page_view() in node.module.
Further processing will retrieve the data for that node from the database and put it into a data structure. Then, it’s time for theming.
Theming the Data
Theming involves transforming the data that has been retrieved, manipulated, or created
into HTML (or XML or other output format). Drupal will use the theme the administrator
has selected to give the web page the correct look and feel. The resulting output is then sent to the web browser (or other HTTP client).
Eaton's answer provides a good overview. (I'm new here so I can't mod him up, thus the comment.)
The brutal "aha" moment for me was realizing everything happens through index.php, and then through the waterfall of modules (core first, then by site). To extend core functionality don't rewrite it. Instead copy the module into /sites/all/modules/ or /sites/[yoursite]/modules and extend THAT, or create a new module in those places. Same for themes. Module directories can contain display code as well, in the form of tpl, css etc.
If you're used to stricter MVC type frameworks like Rails, Django etc. all this gets a little confusing. Modules can mix in a lot of display code, and if you're looking at someone else's modules or templates you'll eventually wind up walking backwards through the stack. That's the beauty/pain of working in PHP.
Ironically, "just build an app" might be the worst way to learn this. Drupal does so much out of the box that's simply obscure until you figure out the control flow. There's nothing in a tpl file that tells you where a function with a fun name like l() comes from, for example.
It depends on how deep an understanding you're looking for; if you have a good knowledge of php, I would suggest reading through the code itself, starting with index.php, and then going on to the includes/bootstrap.inc, and then some of the other scripts in that directory.
The key include files:
menu.inc is very important to understanding how the overall system works, as it handles a lot of the implicit mapping of URLs to content.
common.inc has most of the otherwise-mysterious functions that form the basis of the API.
module.inc handles the hook invocations that Eaton mentioned
form.inc deals with form display, submission and processing
theme.inc handles presentation.
There's also some key functionality in the modules/ directory; in particular, modules/node/node.module forms the basis of the node system, which is in general what's used to encapsulate site content.
The code is, in general, very well-commented and clear. The use of Doxygen markup within the commenting means that the code effectively is the canonical documentation.
It also helps to do this using an editor that can quickly jump to the definition of a function. Using vim in combination with ctags works for me; you do have to tell ctags to index .inc, .module, etc. files as php files.
This (for Drupal 6) & this (for Drupal 7) is a pretty good architectural overview of drupal. If you want more detail then I would start writing something most of the documentation is good. Trying to learn it at a high level of detail without something concrete to achieve will be much more difficult that trying something out.
I learned loads by importing the drupal .php code into a NetBeans project.
You can then run the netbeans debugger and watch the different phases of the page come together.
The best books on the subject are "Pro Drupal Development" and "Using Drupal."
"Pro Drupal Development" includes several nice flowcharts and thorough summaries of each of Drupal's APIs (forms, theming, etc.). It's intended to be especially instructive to people making their own modules and themes, but has lots of value to the average PHP-savvy developer who wants to understand Drupal. Besides which, I've created a custom module for every site I've built, just to gain the extra control over things like selectively hiding fields on various forms (which you generally want to do for the sake of simplifying node forms for end-users), so it's good to have this knowledge under your hat.
"Using Drupal" is aimed at the site developer who wants to know how to build the good stuff like galleries, blogs, and social networking sites. It goes through several use-cases and shows how to configure existing modules to do each job. In the process it familiarizes you with the essential add-on modules "Content Construction Kit" (CCK) and "Views," how to make custom blocks and templates, and the ins-and-outs of maintaining a Drupal site. I recommend this book especially for those who want to get up to speed and actually USE Drupal right away. In the process you gain an understanding of the internal organization of Drupal.
New contributor here, 2 years late on the conversation ;-)
Replying to https://stackoverflow.com/a/1070325/1154755
To extend core functionality don't rewrite it. Instead copy the module
into /sites/all/modules/ or /sites/[yoursite]/modules and extend
THAT, or create a new module in those places. Same for themes.
Actually, I never had to copy a core module to update it. Drupal Hooks should be all you need.
For themes, yeah, sometimes it's the only way to go, but often, you can build a subtheme to get the result you need.

Categories