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

Reading json string function

I have this data and this is set to $data variable.

[
  'type' => 'app',
  'metadata' => [
    'field_application_id' => '{"value":"70001"}',
    'field_x_cient_id' => '{"value":"31"}',
  ],
  'created_at' => '2022-11-30T16:14:58.211Z'
]

I am trying to get the value of field_application_id=>value to get 70001 but not sure what would be the xpath

I can get the data using this $x_1 =  $data['metadata']['field_application_id'];  but it returns {"value":"70001"}

How to print a value in browser console

Hello, 

I am learning module development. 

Under src/Form/MyForm.php, 

I have this method

Finding a relationships of nested paragraphs

I was brought into a site that uses Paragraphs. I'm trying to trace the relationship using the database and database only.

Example:
There are several of Paragraph types. In this case there is

  • Parent paragraph type name - "Section" - ID=284
  • Nested Paragraph Type name = "Slider Band" - ID=281

I need to find the field where the parent is using the nested paragraph. I found where the node was assigning the parent (284).
I just am not sure how to find the parent assigning the nested paragraph (281)

Thanks in advance for your help.

Form states api.

Hello. A question. I am adding to a field entity reference field, select type, the required option, is dependent on another field, using form api state. And he doesn't react. It is the latest version of drupal. Has something changed? In the other text type field it works. I have tried everything exposed on the Internet and it does not become a required field. And very important is an entity reference field. Thanks for the help.

InvalidArgumentException: Class "\Drupal does not exist.

Hi guys, 

I'm trying to learn how to develop modules and I'm having controller path problems

InvalidArgumentException: Class "\Drupal\new_module\Controller\NewModuleController" does not exist. in Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (line 24 of core\lib\Drupal\Core\DependencyInjection\ClassResolver.php).

web\modules\custom\new_module\new_module.info.yml:

Wiew - Exposed Filter

Hello, in a view I have a column with entity reference field that displays me the Description.
In the exposed filter I put the same field (it shows me as textfield and machina name field_required_target_id). In order to filter the data, I have to write the id of the entity reference.
The choice has to be made by description and in, views_exposed_form I transform the field field_requiring_target_id, from type->textfield to type->entity_autocomplete
When I perform the search, the field turns out to be linked with the description and filters my movements well.

Pages

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