Browse Source

Initial commit: add help/permissions/configure icons to module list page.

Frederic G. MARAND 12 years ago
commit
7d43ef48fd
6 changed files with 93 additions and 0 deletions
  1. BIN
      theme/images/configure.png
  2. BIN
      theme/images/help.png
  3. BIN
      theme/images/permissions.png
  4. 19 0
      theme/tweak.css
  5. 7 0
      tweak.info
  6. 67 0
      tweak.module

BIN
theme/images/configure.png


BIN
theme/images/help.png


BIN
theme/images/permissions.png


+ 19 - 0
theme/tweak.css

@@ -0,0 +1,19 @@
+@CHARSET "UTF-8";
+
+a.about-module {
+  background-repeat: no-repeat;
+  display: inline-block;
+  padding: 0 0.5em 0 20px; /* left = 1.25*icon width */
+}
+
+a.about-module-help {
+  background-image: url(images/help.png);
+}
+
+a.about-module-permissions {
+  background-image: url(images/permissions.png);
+}
+
+a.about-module-configure {
+  background-image: url(images/configure.png);
+}

+ 7 - 0
tweak.info

@@ -0,0 +1,7 @@
+core = 6.x
+php = 5.2
+
+name = Tweak
+description = "Tweak Drupal features"
+
+configure = admin/build/tweak

+ 67 - 0
tweak.module

@@ -0,0 +1,67 @@
+<?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');
+}