Skip to content

Instantly share code, notes, and snippets.

<?php
namespace Drupal\manage_inventory\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class InventorySettingsForm.
* @package Drupal\manage_inventory\Form
<?php
namespace Drupal\manage_inventory;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityAccessControlHandler;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
/**
name: Example Rest
type: module
description: Example module Rest service.
core: 8.x
package: Example
<?php
namespace Drupal\example_rest\Plugin\rest\resource;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Psr\Log\LoggerInterface;
name: batch_example
type: module
description: Example module for batch process
core: 8.x
package: Example
batch_example.delete_node_example:
path: '/batch-example/delete'
defaults:
_form: '\Drupal\batch_example\Form\DeleteNodeForm'
_title: 'Batch Example'
requirements:
_permission: 'access content'
<?php
namespace Drupal\batch_example\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class DeleteNodeForm.
*
<?php
namespace Drupal\batch_example;
use Drupal\node\Entity\Node;
class DeleteNode {
public static function deleteNodeExample($nids, &$context){
<?php
namespace Drupal\article_queue\Form;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class ArticleSettingsForm.
*/
name: Article Queue
type: module
description: This module will provide an exapmle for queue worker.
core: 8.x
package: Custom
dependencies:
- ultimate_cron
- queue_ui