8 – Template override doesn’t work

I am trying to develop a Drupal 8 module in which I have to override the html.html.twig template. The idea is that I do not want any of the default html.html.twig template returned instead I only want the custom template returned. I have been spending hours Google hunting and trying to make sense of the many examples and I have gotten myself totally confused.

What is happening is the content of my custom template are being displayed in the default html template so I am seeing the custom content inside the default html template rather than overriding the default content.

For the sake of getting this template override working I have simplified the module as much as possible and simply want to return the contents of a variable into a placeholder in the twig template. Once this override is working I can go back and add the code that will create the correct content to be output into a number of variables in the template.

What I do not understand is exactly how to I override the html.html.twig template.

My module is called unsw_blocks and in the unsw_blocks.module I have the following

function unsw_blocks_theme() {

$theme = (
'unsw_blocks' => (
     'variables' => ('test_var' => NULL),

return $theme;

In the Unsw_blocksController.php have the following

class Unsw_blocksController extends ControllerBase {

  public function unsw_blocks($name) {
  return (
    '#theme' => 'unsw_blocks',
    '#test_var' => $this->t('The variable called test_var simply passes this text itself to the theme template'),

In the custom modules templates directory I have unsw-blocks.html.twig which simply contains

<h1>Testing Template</h1>

<p>test_var: {{ test_var }}</p>

How to override html.html.twig template for my custom page? [closed]

How I can override html template for my custom page?

I need a different html template for my custom page. So I try suggestions hook alter, but it’s don’t work.

 * Implements hook_theme_suggestions_HOOK_alter().
function mymodule_search_theme_suggestions_html_alter(array &$suggestions, array $variables) {
  $current_path = Drupal::service('path.current')->getPath();
  if ($current_path == '/map') {
    $suggestions() = 'html__map';

Template file is in:


magento2 – Override a model not working Magento 2

I tried to override a model in MagentoQuoteModelCartDataCartItem but I cannot override it.

here is my di.xml

    <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="MagentoQuoteModelCartDataCartItem" type="VendorAddProductWithVendorGraphQlModelCartDataCartItem" />

and this is my class

class CartItem extends MagentoQuoteModelCartDataCartItem

     * @var string
    private $sku;

     * @var float
    private $quantity;

     * @var string
    private $parentSku;

     * @var SelectedOption()
    private $selectedOptions;

     * @var EnteredOption()
    private $enteredOptions;

     * @param string $sku
     * @param float $quantity
     * @param string|null $parentSku
     * @param array|null $selectedOptions
     * @param array|null $enteredOptions
    public function __construct(
        string $sku,
        float $quantity,
        string $parentSku = null,
        array $selectedOptions = null,
        array $enteredOptions = null
    ) {
        $this->sku = $sku;
        $this->quantity = $quantity;
        $this->parentSku = $parentSku;
        $this->selectedOptions = $selectedOptions;
        $this->enteredOptions = $enteredOptions;
    public function getQuantity(): float

I’ve tried to use plugins too. But it still didn’t work. Can anyone help me?

vb.net – Overridable e Override

Boa, estou tendo um problema com o VB.NET, seguindo um curso, o instrutor se utiliza das tags Overridable e Overrides para determinar a prioridade de um método comum entre a classe pai e as filhas, segue os codigos de ambas:

Classe Pai:

Public Overridable Sub AumentarSalario()
salario = salario * 1.1
End Sub


Public Overrides Sub AumentarSalario()
salario = salario * 1.15
End Sub

Public Overrides Sub AumentarSalario()
salario = salario * 1.12
End Sub

no curso em questão, quando aplicamos os métodos o valor apresentado é o das filhas, mostrando que o Overridable e Override funcionam, mas no meu código, apenas o valor da classe pai aparece.

Alguma ideia do que estou fazendo de errado?

checkout – Override all shipping method titles based on condition – Magento 2

We have a custom field on the checkout shipping page. If this field is selected we want to override the shipping method title. For instance if the shipping method title is “Standard shipping” we want to change it to “Standard Shipping – Extra text”.

What would be a good way to do this?

magento2 – How to override a method in a vendor module?

Hi so i wrote this code to override a method in the woom cmstree module. But it seems like, something is wrong and i have used an entire day to figure it out, without any success.

My Vendor/MyModule/Block/Widget/Children.php


namespace VendorMyModuleBlockWidget;

class Children extends WoomCmsTreeBlockWidgetChildren


protected $belongsToMenu = "";

public function prepareLinks($treeChildren, $first = false)
    $html = '';

    some random code

    return $html;

My etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="WoomCmsTreeBlockWidgetChildren" type="VendorMyModuleBlockWidgetChildren" />

So this is how i did it. And i of course got the registration file and module.xml

But when i go to the page where this widget is used i get this error

(2021-03-04 20:56:22) main.CRITICAL: Error: Class 'VendorMymoduleBlockWidgetChildren' not found in /home/sonose2/public_html/generated/code/Vendor/Mymodule/Block/Widget/Children/Interceptor.php:7

I have been look at some examples but the are exact as mine and i have been trying alot of other stuff and now i ran out of ideas what to do.

8 – How to override nid filter to accept multiple values on views

I have read a dozen of open tickets on this issue, but none of them explains how to solve this.
Lets say I have a raw array of nids and wanting to override the query in a hook for the nid filter.
The nid filter allows only 1 value or some of the operators given in the image below.

enter image description here

There isnt an operator “is one of” as in the taxonomy reference filter. So how could this be overriden and allow multiple values for the nids?
Is this possible perhaps within the hook_views_query_alter()?

Magento 2: Override Magento_Payment::info/default.phtml

What is the best way to Override Magento_Payment::info/default.phtml in module ?

Magento 2 : Override MagentoFrameworkAppCacheTypeList.php

Is their anyway we can override
Override MagentoFrameworkAppCacheTypeList class in module ?

magento2 – override javascript from module

I want to override file from module.

I create file

That wont work for me so i add file

    map: {
        '*': {
            'locations-modal': 'js/locations-modal.js',

I try move require-config.js in serveral locations still not working.

orginal requirejs config

    map: {
        '*': {
            'locations-modal': 'MageWorx_StoreLocator/js/locations-modal',