ข้ามไปยังเนื้อหาหลัก
หน้าแรก
DrupalThailand

Main navigation

  • หน้าแรก
  • ฟอรั่ม
  • ประกาศงาน
  • บทความ
  • กิจกรรม
User account menu
  • เข้าสู่ระบบ

การแสดงเส้นทาง

  1. หน้าแรก

api

By admin, 5 สิงหาคม, 2021

Drupal 8 Entity API cheat sheet (Part 2)

การทำงานกับ ไฟล์  (File entities)

วิธีส่งค่าไฟล์ออกมาด้วย fid ใน Drupal:

$fid = 31;      // ตัวอย่าง fid
$file_storage = \Drupal::entityTypeManager()->getStorage('file');
$file = $file_storage->load($fid);

การแสดงค่า ออกจากตัวแปร

  • อ่านต่อ เกี่ยวกับ Drupal 8 Entity API cheat sheet (Part 2)
  • Log in to post comments
By admin, 11 พฤษภาคม, 2021

Drupal 8 Entity API cheat sheet (Part 1)

Drupal 8 Entity API cheat sheet

การทำงานเกี่ยวกับ nodes

โหลด Node โดย nid:

$nid = 123;  // ตัวอย่าง nid 
$node_storage = \Drupal::entityTypeManager()->getStorage('node');
$node = $node_storage->load($nid);

Get ค่า nid:

echo $node->id();  // 123

Get ค่า bundle type (หรือ content type):

  • อ่านต่อ เกี่ยวกับ Drupal 8 Entity API cheat sheet (Part 1)
  • Log in to post comments
api

Tags

  • drupal
  • api
  • docker
  • theme
  • drupal8
Powered by Drupal Thailand