Drupal

Drupal 8 ConfigEntityType Entity Query example

so you are using a ConfigEntityType in drupal 8 and you want to know how to do an entity query will you are in luck say you have defined a custom key in your MODULE / config /schema / your_entity.schema.yml file

example

    color:
      type: string
      label: 'color'

Now in your entity class (the one where you put

*@ConfigEntityType(
 *   id = "your_entity_type",

Ajax Easy Module commit 7/4/2016

Right so had an idea for a new Drupal ajax module, to help front-enders hook in to drupal and return ... well what ever they want via ajax.

Meant to be used by people who know what they are doing ...
check out the nice looking code https://www.drupal.org/commitlog/commit/85685/bfa378bb8f5983697229736d6312440ded1b1417

sandbox project link https://www.drupal.org/sandbox/taggartj/2701559

Create a custom hook in module

Say you are creating a module lets call it "MyMODULE" and you want another module say "MYOTHER_MODULE" to beable to hook in and change some data well here we go:

In some (any ) function in  MYMODULE:

<?php

$data = array(
  'thing1',
  'thing2',
  'thing3'
);
//define custom hook 
$results = module_invoke_all('MyMODULE_AWESOMEHOOK');
$count = count($results);
if ($count <> 0) {
  $data  = array_merge($data,$results);
}

dsm($data);

?>

in other MYOTHER_MODULE module:

Drupal 7 Creating A Custom Web Service Module

The follwing is an example of creating a custom drupal 7  web service module , for the Services module.

Why I made this:  the reaso i made this is for the life of me i could not figure out how to
attach a file to a node when creating one with services (but not posting via endpoint/node/nodeid/attach_file ) .
 after you created a file with :

Session Authentication (X-CSRF-Token = token string )
after posting

{
  "username":"admin",
  "password":"admin"
}

to endpoint/user/login.json

Posting to endpoint/file