entities – How to alter entity -> bundle ->add form with custom form mode programatically Drupal 8

I have created a custom entity type called custom_enitity and new bundle scores, using UI. Also got custom form display called score to add score via custom route. I keep getting the following error message.

DrupalCoreEntityEntityStorageException: Missing bundle for entity
type custom_entity in
DrupalCoreEntityContentEntityStorageBase->doCreate() (line 108 of
core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php)

my_module.routing.yml

custom_entity.score:
  path: '/entry/{entry_id}/score'
  defaults:
    _entity_form: custom_entity.score
  requirements:
    _role: 'administrator+judge'
  options:
    parameters:
      entry:
        type: entity:entry

In my folder I have this structure:

custom_entity/src/Form/CustomEntityScoreForm.php

and the name of the class in the file is

class CustomEntityScoreForm extends ContentEntityForm

How do I add bundle (scores) to the routing file, or what am I missing here?

I can’t alter the ‘entity.media.route’

I want my drupal user to see the media edit form using the frontend-theme, not the admin-theme.
In my RouteSubscriber I use
if ($route = $collection->get('entity.media.edit_form')) { $route->setOption('_admin_route', FALSE); }
The function works for ‘book’ entities (for example) but not for media.
Did somebody already had this problem?

magento2 – How to alter the customer checkout/login popup or process in Magento 2.4.1?

I am needing to alter the way the checkout process works on a Magento 2 site because the site offers quotes only and therefore I do not want any mention of the term “Checkout” in the traditional sense. So basically I am trying to either alter what is displayed in the default checkout popup (screenshot below) or show different content altogether.
enter image description here

I have been searching for a module/extension to achieve the results I am looking for but I have found nothing.

It has also been suggested that I remove everything within the click function in the login-popup.js (see code below) and add this:

window.location.href = "https://magento.stackexchange.com/customer/account/login"

Can anyone explain exactly what and where I need to replace this in the code below?

define(
(
'jquery',
'Magento_Customer/js/model/authentication-popup',
'mage/url',
'mage/cookies'
),
function ($, authenticationPopup, url) {
'use strict';

return function (config, element) {
$(element).click(function (event) {
var date = new Date();
date.setTime(date.getTime() + 420000);
event.preventDefault();
$.cookie('login_redirect', url.build('quotation/quote'), {expires: date});
authenticationPopup.showModal();
return false;
});
};
}
);

Any other ideas or direction on how to change the content of the default popup would be greatly appreciated also.

I hope this makes sense.

Thank you,
Rob

How do I alter queries in Elasticsearch Connector?

I need to alter Elasticsearch query before executing it to include functions, but I can not find any hooks to do that.

8 – How to alter the parameters in the core.services.yml file programatically?

I need to modify the filter_protocols parameter inside the core.services.yml file programmatically to add a new protocol. I know how to alter a service but I don’t find any information about how to alter a parameter.

parameters:
  session.storage.options:
    gc_probability: 1
    gc_divisor: 100
    gc_maxlifetime: 200000
    cookie_lifetime: 2000000
  twig.config:
    debug: false
    auto_reload: null
    cache: true
  renderer.config:
    required_cache_contexts: ['languages:language_interface', 'theme', 'user.permissions']
    auto_placeholder_conditions:
      max-age: 0
      contexts: ['session', 'user']
      tags: []
  factory.keyvalue:
    default: keyvalue.database
  http.response.debug_cacheability_headers: false
  factory.keyvalue.expirable:
    default: keyvalue.expirable.database
  filter_protocols:
    - http
    - https
    - ftp
    - news
    - nntp
    - tel
    - telnet
    - mailto
    - irc
    - ssh
    - sftp
    - webcal
    - rtsp

I know how to do this by copying the services.yml file inside the sites/default folder but at this time I need to do this programmatically.

Any idea about how to do it?

8 – How to alter the parameters in the core.extension.yml file programatically?

I need to modify the filter_protocols parameter inside the core.extension.yml file programmatically to add a new protocol. I know how to alter a service but I don’t find any information about how to alter a parameter.

parameters:
  session.storage.options:
    gc_probability: 1
    gc_divisor: 100
    gc_maxlifetime: 200000
    cookie_lifetime: 2000000
  twig.config:
    debug: false
    auto_reload: null
    cache: true
  renderer.config:
    required_cache_contexts: ['languages:language_interface', 'theme', 'user.permissions']
    auto_placeholder_conditions:
      max-age: 0
      contexts: ['session', 'user']
      tags: []
  factory.keyvalue:
    default: keyvalue.database
  http.response.debug_cacheability_headers: false
  factory.keyvalue.expirable:
    default: keyvalue.expirable.database
  filter_protocols:
    - http
    - https
    - ftp
    - news
    - nntp
    - tel
    - telnet
    - mailto
    - irc
    - ssh
    - sftp
    - webcal
    - rtsp

I know how to do this by copying the service.yml file inside the sites/default folder but at this time I need to do this programmatically.

Any idea about how to do it?

taxonomy terms – alter query view by adding fields in an andGroup within an orGroup

I have a multilanguage site with two languages: English and Dutch.
Not all nodes are created in both languages. Some nodes even have no language (‘und’, ‘zxx’).

I want the default Drupal provided taxonomy view output all nodes of a taxonomy-term in the current and no node-language, AND, if present, other nodes of this term from the other language.
The Drupal provided sql is:

SELECT "taxonomy_index"."sticky" AS "taxonomy_index_sticky", "taxonomy_index"."created" AS "taxonomy_index_created",
"node_field_data"."nid" AS "nid", "node_field_data"."langcode" AS "node_field_data_langcode"
FROM {node_field_data} "node_field_data"
LEFT JOIN {taxonomy_index} "taxonomy_index" ON node_field_data.nid = taxonomy_index.nid
WHERE ((taxonomy_index.tid = '14')) AND (("node_field_data"."langcode" IN ('nl', 'und', 'zxx'))
AND ("taxonomy_index"."status" = '1'))
ORDER BY "taxonomy_index_sticky" DESC, "taxonomy_index_created" DESC
LIMIT 11 OFFSET 0

I want, if applicable, extend the where clause so it becomes by example:

WHERE (((taxonomy_index.tid = '14')) AND ((("node_field_data"."langcode" IN ('en', 'und', 'zxx'))
AND ("taxonomy_index"."status" = '1')))
OR (("taxonomy_index"."tid" = '14') AND ("node_field_data"."nid" IN ('43'))
AND ("node_field_data"."langcode" NOT IN ('en', 'und', 'zxx'))))

I wrote a function example_views_query_alter(ViewExecutable $view, QueryPluginBase $query) in which I found out which extra nodes should be added in the extra OR clause. By adding this code:

      $group_id = $query->setWhereGroup('OR');
      $query->addWhere($group_id, 'taxonomy_index.tid', $tid);
      $query->addWhere($group_id, 'node_field_data.nid', $missing, 'IN');
      $query->addWhere($group_id, 'node_field_data.langcode', $langcodes2, 'NOT IN');

But in the extended where clause I get OR instead of AND statements:

WHERE ((taxonomy_index.tid = '14')) AND ((("node_field_data"."langcode" IN ('en', 'und', 'zxx'))
AND ("taxonomy_index"."status" = '1'))
OR (("taxonomy_index"."tid" = '14') OR ("node_field_data"."nid" IN ('43'))
OR ("node_field_data"."langcode" NOT IN ('en', 'und', 'zxx'))))

But it should be an AND group within an OR Group, maybe like:

$query->setWhereGroup('OR');
$query->setWhereGroup('AND');
$query->addWhere(...

Who can help me out to achive this?

dnd 3.5e – Can a god make an epic spell permanent using alter reality?

It seems really overpowered, which is why I’m asking. But the text for alter reality:

…The deity can render a magical or supernatural effect permanent. The rest requirement varies with the effect: 10 minutes per level of the effect times the number of subjects affected, 10 minutes per total Hit Dice of creatures affected, or 10 minutes per 10-foot cube affected. Use the highest applicable value…

…says that any magical or supernatural effect could be made permanent (which an epic spell certainly is). So could a god invest in a really expensive epic spell to boost itself, then render the effect permanent?
Of course, the effect could be dispelled, but infinite duration is still insane for some spells.

8 – How to alter an existing breadcrumb link programmatically?

I am trying to alter the ‘Home’ Breadcrumb link using

hook_system_breadcrumb_alter()

The default Breadcrumb class allows you to add New links using the

addLinks

method.

However it does not allow one to edit the links. Is there a way to edit an existing link directly?

alter table – Why can’t you add an Identity to an existing colum in SQL Server?

What is so special about an Identity column?

See: https://stackoverflow.com/questions/1049210/adding-an-identity-to-an-existing-column

I am pretty sure there is a valid reason, but I’m trying to get a better understanding of SQL.

So what is so special about an Identity column that this can’t be easily added in retrospect?

Why is this not just a single int/bigint flag somewhere that is being incremented every time you insert a new row?