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

Hi,

I have this sample data and this is just a part of data but it is swagger which is a JSON.

a:14:{s:7:"swagger";s:3:"2.0";s:4:"info";a:6:{s:10:"x-ibm-name";s:22:"test-summary";s:5:"title";s:28:"test Summaries for test";s:7:"version";s:5:"1.0.0";s:11:"description";s:84:"Account Information, retrieve account test and statuses for the test.";s:7:"contact";a:2:

This data is extracted as string on the variable "apiSwagger"

$apiSwagger = $apiNode->api_swagger->value;

After using a delete all nodes API, ONLY the values of the author column are displayed

Using Drupal 10:

Is this way below (to delete all content for a content type) reliable (instead of using the loadMultiple method)?

\Drupal::database()->delete('node')
->condition('type', "mycontenttype")
->execute();

Update field settings' value upon form submission!

Created a custom webform product module that includes a composite field for stock settings. After submitting the form, what is the proper way to update the stock value in the backend?

How to make the first POST request in VS Studio to add an entity?

Hello,

I like to make a POST request to add an entity. I was able to do it in Postman. Now I am trying to do the same in VS Studio, but I am getting the error "The website encountered an unexpected error. Please try again later.". 

I created the route in the module's routing.yml that points to a method of the Controller for an HTTP POST request. 

In Postman, I was able to make a POST request as follows and was able to add the entity just fine.

How to use an exposed views filter without leaving a custom route?

Hi, I've created a report that displays all the file entites that can be found in all the media revisions that aren't the latest revision on my site. This has taken the form of two different view display executions, which are compared and processed ultimately leading to a final result set and that is rendered to my custom route by a third view that adds back pagination and some extra fields I want to include after all the calculations are done. All this takes place in a controller in my custom module.

Use of http_client in a custom middleware

I would like to implement 'http_client_middleware' on Drupal 10 in order to use the cookie to authorize against the API available over HTTPS. For that I need to:

  1. Perform a GET request to login to the API and get the cookie
  2. Use the cookie in following requests to authenticate with the API

I have working code implemented with the controller and now I would like to use it properly with 'http_client_middleware'. I have found a working example in:

Pages

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