hook_schema()

We use hook_schema() to define the current version of the database schema. During the module installation process in Drupal, you can create DB tables using .sql query or you can use hook_schema() to create tables and fields. A Drupal schema definition is an array structure representing one or more tables and their related keys and indexes. A schema is defined by hook_schema() which must be located in your module’s .install file. By implementing hook_schema() and specifying the tables your module declares, you can create and…

Continue reading »

hook_access($op, $node, $account)

Define access restrictions. This hook allows node modules to limit access to the node types they define. Parameters $op The operation to be performed. Possible values: “create” “delete” “update” “view” $node The node on which the operation is to be performed, or, if it does not yet exist, the type of node to be created. $account A user object representing the user for whom the operation is to be performed. Return value TRUE if the operation is to be allowed; FALSE if the operation is…

Continue reading »

Implementation of hooks in Drupal

In your directory /sites/all/, you have to create 2 sub-directories called “themes” and “modules” where your custom themes and modules are located. What “hooks” in Drupal is all about? They allow your custom-built modules to interact with the Drupal core.  A hook is a function that is named foo_hookname(), where “foo” is the name of your custom-built module (whose filename is foo.module) and “hookname” is the name of the hook. Each hook has a defined set of parameters and a specified result type. To extend…

Continue reading »

How do I learn to build a module in Drupal

Today I have a project from AppraisalWorld that I need to build a module in Drupal. I have known this Drupal CMS since I learned the Joomla Environment but I didn’t have a chance to build many complex modules. So this is an opportunity for me to learn how to build a complex module for Drupal environment. First, I go to www.drupal.org and read how Drupal works after I install. Then I watched some videos that teach me why and how to use Drupal. Of…

Continue reading »

imagegrabscreen function in php5

imagegrabscreen function is only available in PHP 5.2.2. This function is useful when it’s necessary to make a screenshot of a website or a private application web page. For example, when a lender wants to view credentials of an appraiser before an appraisal job is assign. That appraiser should reveal his/her credentials of their license/certificate/reports in an image rather than in html format. Here is how you’re going to use it. Remember to upgrade your server to php version 5.2.2, or if you have a hosting provider, ask them…

Continue reading »