Drupal 8

By admin, 22 十一月, 2019

1. 管理匿名用户Form页面缓存

use Drupal\Core\Cache\Cache;

// 在匿名用户可以访问的表单里加入下面逻辑,包括列表页面和具体的查看页面

    $form['#cache']['tags'] = ['your_custom_tag_name'];

// 在写入逻辑里让缓存失效
    Cache::invalidateTags(['your_custom_tag_name']);

2. 禁用匿名用户Form页面缓存

在<module>.routing.yml文件路由定义里增加no_cache: 'TRUE'可禁用缓存

标签

By admin, 7 一月, 2017
  1. 先安装一个RESTUI模块
  2. 启用配置好之后可以访问GET接口,例如:http://cto.eguidedog.net/node/241?_format=json
  3. POST接口,例如:curl -H "Content-Type: application/json" -X POST -d '{"type":[{"target_id":"braille_printing_application"}],"title":[{"value":"test2"}],"field_address":[{"value":"addr2"}],"field_name":[{"value":"name2"}],"field_phone":[{"value":"phone2"}],"field_zipcode":[{"value":"zipcode2"}]}' http://cto.eguidedog.net/entity/node

标签

By admin, 9 十月, 2015

First, it's really a bad idea to use Drupal 8 beta version on production site like me. Because Drupal 8 beta release do not provide a way to upgrade between beta versions. The database and API are not frozen at all.

If you are unlucky like me, you can try following steps:

标签