|
|
# Module : Yakforms
|
|
|
|
|
|
Custom module implementing custom general-purpose methods for Yakforms.
|
|
|
As detailed in https://www.drupal.org/docs/7/creating-custom-modules, the Yakforms module contains the following necessary files :
|
|
|
* `yakforms.info`, which contains a number of data about the module (dependencies, version)
|
|
|
* `yakforms.install`, which contains an implementation of hook_schema, creating the necessary Postgres tables on module activation.
|
|
|
* `yakforms.module`, which implements the module functions.
|
|
|
* `includes/*`, include files containing classes, called in `yakforms.module`.
|
|
|
|
|
|
This module is completed by [yakforms_public_results](https://framagit.org/framasoft/framaforms/-/wikis/Module-:-framaforms_public_results) and [yakforms_share_results](https://framagit.org/framasoft/framaforms/-/wikis/Module-:-yakforms_share_results), respectively allowing results to be shared with all users (including anonymous ones) or specific registered users.
|
|
|
|
|
|
## Database
|
|
|
The .install file contains a single table definition :
|
|
|
|
|
|
**Table : yakforms_expired** : Table containing expiration information for Yakforms webforms.
|
|
|
|
|
|
| nid integer | date_notified integer | notified integer |
|
|
|
| ------------| --------------------- | ---------------- |
|
|
|
|
|
|
where :
|
|
|
* **nid** is a foreign key to node.nid,
|
|
|
* **date_notified** is a UNIX timestamp to the date the user was notified of his.her form expiration,
|
|
|
* **notified** is either 0 (the user wasn't yet notified) or 1 (an email was already sent).
|
|
|
|
|
|
|
|
|
## Nodes
|
|
|
The `yakforms` module defines several [drupal nodes](https://www.drupal.org/docs/7/nodes-content-types-and-fields/about-nodes) of type `page`. These correspond to pages necessary to the site : index page, documentation, custom 404 and 403 pages.
|
|
|
|
|
|
These nodes are created during the installation of the module, based on HTML templates located under `sites/all/modules/yakforms/includes/html`. They are **customizable by the admin** as nodes normally are, and normally and re-installation of the module should not trigger a re-installation of the page.
|
|
|
|
|
|
_WARNING : when the module is reinstalled, Drupal will look for nodes named `site_404`, `site_frontpage`, etc. If these don't exist, Drupal will consider the pages don't exist, and create them. You should therefore **NOT** change the title of the pages, otherwise the pages will be recreated and redefined. Your changes won't be lost however, the pages will still be present in the database, but your frontpage will be redirected to the new unmodified one._
|
|
|
|
|
|
## Blocks
|
|
|
The module also defines custom Drupal blocks. These include, but are not limited to :
|
|
|
* help stickers at the form creation page
|
|
|
* footer
|
|
|
* login and user link blocks
|
|
|
|
|
|
You can't directly modify their content in the Drupal admin interface, you'll have to modify the code itself. In order to do that, you'll have to modify the following file : `sites/all/modules/yakforms/yakforms.module`. Look for the function `yakforms_block_view()`, identify the block you want to change, and modify the content of `$block[content]['#markup']` in the corresponding `switch / case`.
|
|
|
|
|
|
This is not ideal, and might change in the future, but that's all we have for now :shrug_tone1:
|
|
|
|
|
|
## Menu links
|
|
|
The module defines one last thing : [menu links](https://www.drupal.org/docs/7/working-with-menus). These correspond to content accessible at a given URI. The three following links are defined :
|
|
|
* `admin/config/system/yakforms` (**only accessible to admin**) : the Yakforms module configuration menu. The admin can define a number of variables here, including the site title and slogan, expiration and deletion periods for forms, etc.
|
|
|
|
|
|
_NB : a number of these informations are defined in other module adminstration pages. This page just aim to centralize these information in a single menu page, as Drupal has a certain complexity._
|
|
|
|
|
|
* `admin/yakforms/dashboard` (**only accessible to admin**) : the adminstration dashboard of Yakforms. It contains a number of information concerning the current number of forms created, form submissions, users registered, and also gives links to the 10 forms with the most answers.
|
|
|
|
|
|
|
|
|
Each is accessible at `<base-url-of-my-site>/<menu-link>`. |