Override drupal's core include files - drupal

Specifically common.inc. I need to modify format_date, but I want to do it safely.

You can only override a few specific files (like session.inc or cache.inc), it is not possible to override common.inc.
However, you don't need to. See my answer to your other question: Drupal not using custom time format type

Related

What is the best way to override a function in an aikau widget in alfresco?

I am using Alfresco 6.2 Enterprise version. I have a requirement which calls for a couple of modifications in https://dev.alfresco.com/resource/docs/aikau-jsdoc/AlfSearchList.js_.html module.
What is the best approach to override the onScopeSelection function?
Is there a way I can modify searchPayload to include a new attribute?
I have gone through Alfresco documentation and couldn not figure out what's the best way to override an existing aikau.
The best option to override a function in Aikau is typically to extend the widget module in question and use module "class hierarchy" to override the function inherited from the AlfSearchList. The OOTBee Support Tools project has an example of a module extending AlfList and overriding its onDataLoadSuccess function. Once you have your own custom module, you can use a Surf Extension Module to customise the JSON model of the faceted search page to change the name of the module used for the search list to yours.
Unfortunately there is no other way to modify the searchPayload other than overriding the loadData function as well. And then the added attribute would not do anything unless you also override the SearchService's onSearchRequest function and used your custom service instead of the default by again modifying the JSON model of the page.

Stylelint - How to restrict having variables to specific files only?

Is it possible to give error/warning if someone in the team tries to add the variable as property (not value) in any other file other than variable.css?
it could be either CSS native variables or Sass variables
There is no rule for that in stylelint as it is a very specific use case. The plugin system was built to accommodate these types of use cases, though. The solution is create your own plugin for your needs.

Is there a way to override bundle DI extension file in Symfony?

I'm having a hard time figuring out how to override the DI extension file in Sf2.
The reason I want to override this file is that I'm using a 3rd party bundle where they define certain services, check for certain params in this file. However, since I want to customize these settings and store them in a different way I need a way to either override or skip the loading of this file.
I have searched high

In Drupal, how do I override a template in a core module without modifying the actual core?

I want to edit the search results of a search using the search module. The template in question is search-result.tpl.php. I see that it's in html/modules/search, but I'd like to keep the modification out of the core and keep it in my sites folder. Is there a way to change the place that drupal looks for that specific template? If not, how can I accomplish my goal?
Copy the search-result.tpl.php into your theme's directory, modify it as needed, and clear the theme cache.
You may also want to check out the About overriding themable output handbook page for additional details.

How / where can I include a library?

how can I include a custom library in Drupal ?
For example I need to insert this statement somewhere, to use the dompdf library:
require_once("dompdf_config.inc.php");
Once the this file is included, i can trigger custom php code from my drupal back-end custom actions.
thanks
You want to include it, in order to use it, not?
If so, just include it at the place where you are going to use it.
E.g. in your own dompdf.module.
. That module would then distribute the dompdf funcitonality trough your Drupal site.
Another, common route is to place the include in /sites/all/libraries/
and then to include it from your dompdf.module.
libraries in /sites/all/libraries/ are often libraries that will be used in more then only your module: probably in your theme too, or in other modules too.
2 Places to do it would be
In a module's .module file, if you always want it included
Wrapped in a function that you can call, if you manually want to include it.

Resources