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

Main navigation

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

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

  1. หน้าแรก

drupal8

By admin, 3 กันยายน, 2021

Install Drush on Mac ox for Drupal 8

ใช้กับ php 7.4

wget https://github.com/drush-ops/drush/releases/download/8.3.5/drush.phar
chmod +x drush.phar && mv drush.phar /usr/local/bin/drush

 

  • อ่านต่อ เกี่ยวกับ Install Drush on Mac ox for Drupal 8
  • Log in or register to post comments
By admin, 7 สิงหาคม, 2021

เพิ่ม class body tag ตาม path เว็บไซต์

แก้ไขที่  .theme ใน folder Theme ของคุณ  แล้ว โค้ดที่ได้จากข้างล่างนี้  
(THEMENAME  เปลี่ยนเป็นชื่อ Theme ของคุณเอง)

/**
 * Implements hook_preprocess_html().
 */
function THEMENAME_preprocess_html(&$vars) {
  // Get the current path
  $current_path = \Drupal::service('path.current')->getPath();
  $internal = \Drupal::service('path_alias.manager')->getAliasByPath($current_path);

  // Assign it to body class 
  $vars['attributes']['class'][] = str_replace("/", "", $internal);
}
  • อ่านต่อ เกี่ยวกับ เพิ่ม class body tag ตาม path เว็บไซต์
  • Log in or register to post comments
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 or register 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 or register to post comments
drupal8

Tags

  • siteaudit
  • ฟรี
  • iot
  • drupal8
  • drupal
Powered by Drupal Thailand