Documentation contributors
Review CVS Applications
You can help review applications for CVS accounts from new contributors.
See http://drupal.org/project/cvsapplications
Reviewers can use these guidelines for evaluating submissions:
Note that you don't even need to have a CVS account in order to review applications, so you can help other applicants improve their submissions while waiting for your own approval.
Help text
Drupal modules can provide help text to users in the .info file, and by implementing hook_help(). A hook_help() implementation defines help text for the URLs your module provides (settings pages, editing forms, etc.), indexed by the path to the page. In addition, the special path 'admin/help#modulename' should be used to define an overview help page for each module.
Short Description
A short description of your module goes in the mymodule.info file, in element "description"; this description is displayed on the Modules administration screen, to tell a site administrator what your module does. The description should start with a verb and be relatively concise. Example (from the core node module in Drupal 7):
description = Allows content to be submitted to the site and displayed on pages.Help text for your module's paths
Help text for individual paths in your module is generally fairly brief, as it is displayed either at the top of the page or in a block, depending on which version of Drupal you are running. Here is an example of an individual path's help text, from the Node Revisions screen in the Node module [this is part of the node_help() implementation of hook_help()]:
case 'node/%/revisions':
OpenLayers Layer Type API
The OpenLayers module supports layer types, which are ctools plugins. Layer types are related to layers: layers are exportables which contain per-layer configuration, like map server URLs and parameters. Layer types are plugins which provide the forms necessary to create new layers and the functionality of those layers on a map. For instance, the openlayers_views layer type contains the method required to pull data from views and insert it into its own features array.
For instance, the code of the MapBox layer type is
<?php
class openlayers_layer_type_mapbox extends openlayers_layer_type {
/**
* Provide initial values for options.
*/
function options_init() {
return array(
'maxExtent' => array(-20037508.34,-20037508.34,20037508.34,20037508.34),
'baselayer' => TRUE,
'serverResolutions' => openlayers_get_resolutions('900913'),
'resolutions' => openlayers_get_resolutions('900913'),
'maxExtent' => openlayers_get_extent('900913'),
'projection' => array('900913'),
'baselayer' => TRUE,
'layer_handler' => 'MapBox',
);
}
/**
* Options form which generates layers
*/
function options_form() {
return array(
'layername' => array(
'#type' => 'textfield',
'#title' => t('Layer Name'),
OpenLayers Tutorial
Setting up a Map
- Download and enable the OpenLayers module and the ctools module
- You'll also want to download the Views module if you want to display any Drupal data on a map.
- Enable OpenLayers, OpenLayers UI, and OpenLayers Views
- Create a view which uses the "OpenLayers Data" style plugin
- Go to the OpenLayers administration page (admin/settings/openlayers) and the layers tab. Add a new layer if desired.
- Go to the OpenLayers administration page (admin/settings/openlayers) and the presets tab. Create a new preset with a map layer and the view you created before will be an option as an overlay layer.
- Save your new map preset and go back to the views interface.
- Create a new view with the 'OpenLayers Map' style plugin, and give it a display, like a Page display.
- View the view and its generated map.
Display a custom message with the Node_limitnumber module.
I wanted to restrict the the number of posts a Certain Role could create. So I installed the "node_limitnumber" module.
It worked out great, except I was wanting a bit more functionality when it came to the execution of the code.
As the module is now, if a user try's to create more than their allowed the, module re-directs them to the add content page and following error message is displayed...
"You can't create more content of type !type, sorry."
Effective... But I decided to add some "snippets" to the node_limitnumber.module file for configuring conditional messages. This was my first real php programming venture.
Before.. (starting at line 152 of node_limitnumber.module,v 1.6.2.1 2009/09/22)
$result = db_query( $q, $node->type, $user->uid);
$num = db_affected_rows();
if ($num >= $limit) {// We have the data, now we check the limit
$nodetypename = node_get_types('name', $node);
drupal_set_message(t("You can't create more content of type !type, sorry.", array('!type' => $nodetypename)), 'error');
drupal_goto('node/add');
}
}
}
}And After...
$result = db_query( $q, $node->type, $user->uid);
$num = db_affected_rows();
if ($num >= $limit) {// We have the data, now we check the limit
Embedding Slideshare Content
Inserting Slideshare presentations is not as easy as youtube content or other video content..
I just want to demonstrate in 2 easy steps how to do it..
We have our presentation:
http://www.slideshare.net/mayank.grd/introduction-to-drupal-2322913
You cannot use any of the "slideshare provided links" as an embed link for the video_filter.
- on the slideshar site choose "Post to WordPress" - you'll get a code like this one
[slideshare id=2322913&doc=drupal-091022145238-phpapp02] - for embedding this presentation in your drupal site, you should use the following code
[video:slideshare.net/?id=2322913&doc=drupal-091022145238-phpapp02]
In this way you can easily insert every slideshare presentation - just copy the WordPress Code and paste the necessary part, as shown above, in your video_filter Link.
