AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Drupal Entity Api

skill-edutrul-drupal-ai-drupal-entity-api · by edutrul

Drupal Entity API — loading, creating, updating, and deleting entities using entity_type.manager. Node, User, Term, Media patterns.

No reviews yet
0 installs
48 views
0.0% view→install

Install

$ agentstack add skill-edutrul-drupal-ai-drupal-entity-api

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-edutrul-drupal-ai-drupal-entity-api)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Drupal Entity Api? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Drupal Entity API

Loading Entities

// Load a single node
$node = $this->entityTypeManager->getStorage('node')->load($nid);

// Load multiple nodes
$nodes = $this->entityTypeManager->getStorage('node')->loadMultiple([1, 2, 3]);

// Load by properties
$nodes = $this->entityTypeManager->getStorage('node')->loadByProperties([
  'type' => 'article',
  'status' => 1,
  'uid' => $uid,
]);

// Load user
$user = $this->entityTypeManager->getStorage('user')->load($uid);

// Load term
$term = $this->entityTypeManager->getStorage('taxonomy_term')->load($tid);

// Load media
$media = $this->entityTypeManager->getStorage('media')->load($mid);

Entity Query

$query = $this->entityTypeManager->getStorage('node')->getQuery()
  ->accessCheck(TRUE)
  ->condition('type', 'article')
  ->condition('status', 1)
  ->condition('field_tags', $tid)
  ->sort('created', 'DESC')
  ->range(0, 10);

$nids = $query->execute();
$nodes = $this->entityTypeManager->getStorage('node')->loadMultiple($nids);

Creating Entities

// Create a node
$node = $this->entityTypeManager->getStorage('node')->create([
  'type' => 'article',
  'title' => 'My Article',
  'status' => 1,
  'uid' => $this->currentUser->id(),
  'field_body' => [
    'value' => 'Content here',
    'format' => 'basic_html',
  ],
]);
$node->save();

// Create a taxonomy term
$term = $this->entityTypeManager->getStorage('taxonomy_term')->create([
  'vid' => 'tags',
  'name' => 'New Tag',
]);
$term->save();

Updating Entities

$node = $this->entityTypeManager->getStorage('node')->load($nid);
if ($node instanceof NodeInterface) {
  $node->set('title', 'Updated Title');
  $node->set('field_body', ['value' => 'New content', 'format' => 'basic_html']);
  $node->save();
}

Deleting Entities

$node = $this->entityTypeManager->getStorage('node')->load($nid);
if ($node) {
  $node->delete();
}

// Delete multiple
$storage = $this->entityTypeManager->getStorage('node');
$nodes = $storage->loadMultiple($nids);
$storage->delete($nodes);

Accessing Field Values

// Simple field
$title = $node->get('title')->value;
$status = $node->get('status')->value;

// Text with format
$body = $node->get('body')->value;
$format = $node->get('body')->format;

// Reference field
$tid = $node->get('field_tags')->target_id;
$term = $node->get('field_tags')->entity;

// Multi-value field
foreach ($node->get('field_images') as $item) {
  $fid = $item->target_id;
  $file = $item->entity;
}

// Check if field is empty
if (!$node->get('field_image')->isEmpty()) { ... }

Access Checking

// Always add access checks
$query->accessCheck(TRUE);

// Check entity access
if ($node->access('view', $account)) { ... }
if ($node->access('update', $account)) { ... }

Inject EntityTypeManager

public function __construct(
  private readonly EntityTypeManagerInterface $entityTypeManager,
) {}

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.