123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- /**
- * @file
- * Drupal Tweaking library
- *
- * @copyright Copyright 2011 Ouest Systèmes Informatiques SARL
- *
- * Licensed under the General Public License version 2 or later.
- */
- /**
- * Implements hook_form_system_modules_alter().
- *
- * Add the D7 "help/permissions/configure" options to the module listing page.
- */
- function tweak_form_system_modules_alter(&$form, &$form_state) {
- if (!isset($form['#theme']) || $form['#theme'] != 'confirm_form') {
- $actions = array(
- 'help' => t('Help'),
- 'permissions' => t('Permissions'),
- 'configure' => t('Configure'),
- );
- foreach ($form['validation_modules']['#value'] as $name => $module) {
- $info = $module->info;
- $description = isset($info['description'])
- ? $info['description']
- : '';
- $links = array();
- foreach ($actions as $action_name => $action_title) {
- if (!empty($info[$action_name])) {
- $offset = strpos($info[$action_name], '#');
- if ($offset === FALSE) {
- $options = array();
- $path = $info[$action_name];
- }
- else {
- $options = array(
- 'fragment' => drupal_substr($info[$action_name], $offset + 1), // +1 to skip #
- );
- $path = drupal_substr($info[$action_name], 0, $offset);
- }
- $class = "about-module about-module-$action_name";
- $options += array(
- 'attributes' => array('class' => $class),
- );
- $links[$action_name] = l($action_title, $path, $options);
- }
- }
- if (!empty($links)) {
- $form['description'][$name]['#value'] .= '<br />' . implode('', $links);
- }
- }
- }
- }
- /**
- * Implements hook_init().
- *
- * Add module CSS.
- */
- function tweak_init() {
- drupal_add_css(drupal_get_path('module', 'tweak') . '/theme/tweak.css');
- }
- function tweak_views_api() {
- $ret = array(
- 'api' => 2,
- 'path' => drupal_get_path('module', 'tweak') . '/views',
- );
- return $ret;
- }
|