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

How to programmatically create content type with entity reference field in Drupal 8?

Hi,

I am writing a custom module that will create a content type during installation. The content type will have a title and entity reference fields. I know how to create a text fields storage using yml configuration. Here is how I am creating text field storage:

langcode: en
dependencies:
  enforced:
    module:
    - my_module
  module:
  - node
id: node.field_name
field_name: field_name
entity_type: node
type: string
settings:
max_length: 10
module: core
locked: false

/admin/content/media does not load

Sometimes (not always) when I try to access the /admin/content/media page, the page does not load. Instead, it just shows that the domain is registered. It looks like this:

Untitled.png (3410×1290) (ibb.co)

I have about 1000 pictures uploaded there. Does anyone know how to fix this?

CSV file import programmatically

I need to import data from a csv file. I tried feeds but I don't know why it doesn't upload all the data and I decided to do it manually.
I wrote a form and in the buildForm I inserted the file choice fields, text field to display the line that I import and the button to start the import.
Since I am still inexperienced with Drupal mechanisms, I would like to show the various steps in the submitForm func to understand what to do.
I had thought about using the command

validate

In version 8.17 I used the code below to avoid inserting a node with the same title.
I upgraded to version 9.2.6 and the same code no longer works for me. I checked but it doesn't seem like anything has changed.
This is the code I use

Force German language when mapping language field on a migration?

Content type is for blog_articles and default language is EN. Would like to enable "Show language selector on create and edit pages" so articles can be created with German language selected (without there being an English version)

How to paginate a table using ajax in from?

I need to use form pager to paginate a table that I get from ajax
updating the from ['pager'] from the ajax method if it creates the paging but the navigation between the pages does not work.

Pages

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