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
- 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) - 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 - in the custom_fomatters module list, configuration(also you can find this configuration in structure/formatters)
- 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 - 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 - in the content type edit menu, display manage, the field_google_document_id format change to the custom format just create: google-doc
- 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.
没有评论:
发表评论