Mercurial > defr > drupal > popups
diff popups.api.php @ 0:76f9b43738f2
Popups 2.0-alpha5
author | Franck Deroche <franck@defr.org> |
---|---|
date | Fri, 31 Dec 2010 13:41:08 +0100 |
parents | |
children | 4215c43e74eb |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/popups.api.php Fri Dec 31 13:41:08 2010 +0100 @@ -0,0 +1,51 @@ +<?php +// $Id: popups.api.php,v 1.1.4.2 2009/03/05 19:52:48 starbow Exp $ + +/** + * @file + * Provides hook documentation for the Popups API. + */ + +/** + * Creates the rule registry for the popups. + */ +function hook_popups() { + $popups = array(); + $popups['admin/content/taxonomy'] = array( + // Act on the first primary tab. + 'div#tabs-wrapper a:eq(1)', + // Act on the 2nd column link in the table. + 'table td:nth-child(2) a' => array( + // Don't update the original page. + 'noUpdate' => TRUE, + ), + ); + return $popups; +} + +/** + * Allows altering of the popup rule registry. + * + * @param $popups + * The popup registry to be altered. + */ +function hook_popups_alter(&$popups) { + // Remove acting on the primary tabs. + unset($popups['admin/content/taxonomy']['div#tabs-wrapper a:eq(1)']); + + // Make clicking on the link update the original page. + $popups['admin/content/taxonomy']['table td:nth-child(2) a']['noUpdate'] = FALSE; +} + +/** + * Adds skins to the Popups API. + * + * Returns an associative array where the key is the skin name, along + * with CSS and JS values to tell where the skin can be found. + */ +function hook_popups_skins() { + $skin['My Skin'] = array( + 'css' => drupal_get_path('module', 'myskin') .'/myskin.css', + 'js' => drupal_get_path('module', 'myskin') .'/myskin.js', + ); +}