标签

2016年9月27日星期二

Drupal 7 show google DOC

Drupal 7 show google DOC

Try some google documents modules to show Google documents in Drupal, but they don't work.

This is a simple way to show types google documents in Drupal 7 web site, we don't need two much modules or code to finish it, I write this because I forgot why I can do it before, take sometime I find the solution:
this is running in Drupal 7.50 core version


  1. install a module: (https://www.drupal.org/project/custom_formatters) custom_formatters
    the current version:custom_formatters-7.x-2.4.zip(this is for windows Drupal7)
  2. install another module:Token (token),this is not require by custom_formatters module installation, but the configuration in custom_formatters depend on this module.
    (https://www.drupal.org/project/token) 
    https://ftp.drupal.org/files/projects/token-7.x-1.6.zip
  3. in the custom_fomatters module list, configuration(also you can find this configuration in structure/formatters)
  4. add a new formatter settings, use this code:
    <iframe width="[node:field_doc_width]" height="[node:field_doc_hight]" src="https://docs.google.com/file/d/[node:field_google_document_id]/preview"></iframe>
    you can use title: google-doc, format:HTML+Tokens
  5. update or add a new content type, include 3 fields with the name in the No.4 code
    field_doc_width /int
    field_doc_high /int
    field_google_document_id /text
  6. in the content type edit menu, display manage, the field_google_document_id format change to the custom format just create: google-doc
  7. add a new content in this content type, put the google article id (example:0B5F_qaK8bYV3bGNFd1pOYXJmbVU)in field_google_document_id, input width and hight and it works.

没有评论:

发表评论