This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

How to add field to User though source code? [programmatically]

I want to extend the User entity with additional fields, like 'address', 'city' and etc.

My goal is to achieve this through source code, not by using admin panel GUI.

I cannot find anywhere The Right Way to achieve this.

I am new to Drupal and any advice is helpful.

How to programmatically add an image to a field in a new Node? D8

How to programmatically add an image to a field in a new Node? D8

Thanks.

That doesn't work:

<?php
$file = system_retrieve_file('http://img.yandex.net/i/www/logo.png', NULL, TRUE);

 

for($i=0;$i<5;++$i){

$node = Node::create([
'type' => 'avtoxml',
'title' => $u[$i]->mark_id.$u[$i]->year,
'field_nazvanie' => [['value' => $u[$i]->mark_id]],

Any way to modify the revisions tab for a node?

Specifically talking about this table in the admin panel: https://ibb.co/G55GHHj (open link to view image)

I'd like to add some extra information in this table. Is there any way to alter what is displayed in this table from Drupal admin panel? If not, any way to do it in code? Thanks!

Default value paragraph field according to input other form field

In a form there are two link fields to enter a Facebook address. 1 Field belongs to paragraph type. Now I want to make the paragraph field change its default value according to the input in the other FB field.

Many to many to many?

Here is my scenario.

I have a song

It has musicians

Musicians play instruments

So, a song can have many instruments and many musicians

An instrument can have many musicians and many songs

A musician can have many songs and many instruments

I'm trying to model this in content types/taxonomy but I've become stuck.

My thought was to have a song content type, instrument taxonomy, and musician content type

D9 Database Query error

In my *.module file for a module I have:

$connection = \Drupal\Core\Database\Database::getConnection('default', 'external');

Drupal::database($connection)->query(

            "SELECT thing FROM stuff  WHERE thing......",

             $arguments

)->execute();

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions