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

Correct format for a post request

Hi, 

I am trying to create a simple todo app as a headless Drupal site using a Vuejs front end ( I'll share here if and when I actually figure it all out so others can learn same as I am trying to do)

I ve managed to get the get requests working fine, but I have now got stuck on making a post request work

Can anyone tell me what I'm doing wrong please re the following

the data I'm trying to pass is as follows: 

data: {

title: [

{

Drip-feed module

Hi

Hope you guys can help. I was trying to create a drip feed system using  drupal 8(guardr) commerce 2, License and content.

I want am trying to achieve is when a user pays for a license they get a role. that role has access to a course(s). that course will be drip fed every x amount of days(starting from the granted date) depending on the course(s). User can have more then one course. I understand there is a wp module. Surprised there isn't one for drupal. spent about 2 months trying to figure out which way to go. Now I know hundreds of ways not to do it.

Block plugin build function can't access route parameter?

I have a block plugin with the following build method

  public function build() {
    $build = [];

Alternative for .inc files

I was wondering what is the correct alternative of .inc files in Drupal 8? That is to say, if I want to create some functions that should be only be loaded when required, like it was with module_load_include() in D7. Though this function is still there in D8, I hear that this is not the best procedure. Is that so?

D8 alter hook sequence

I was wondering if using hook_module_implements_alter() is a good practice in D8 also to alter the order of execution of hooks?

I came to hear that it is suggested to do this with events that was introduced in D8 which will be a better way, but I could not find any reference that says not to use hook_module_implements_alter()in D8. One such ref.

Get entity value

Here is my entity object.

​​​​​​​Payment {#1020 ▼
  #values: array:17 [▼
    "amount" => array:1 [▼
      "x-default" => array:1 [▼
        0 => array:2 [▼
          "number" => "2.43"
          "currency_code" => "EUR"
        ]
      ]
    ]

I need to get the "number" value, but I can't get it easily.

$amount= $entity->get('amount')->getValue();

I get this result :

Pages

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