Browse Source

merged contentadminrelink submodule

Bachir Soussi Chiadmi 9 years ago
parent
commit
775d25dbcc

+ 29 - 0
sites/all/modules/gui/contentsadminrelink/contentsadminrelink.info

@@ -0,0 +1,29 @@
+name = Contents admin relink
+description = "Relink admin/content and admin/content/node with the path of your choice (a view for example)"
+
+; Core version (required)
+core = 7.x
+
+; Package name (see http://drupal.org/node/542202 for a list of names)
+; package = 
+
+; PHP version requirement (optional)
+; php = 5.2
+
+; Loadable code files
+; files[] = contentsadminrelink.module
+; files[] = contentsadminrelink.admin.inc
+; files[] = contentsadminrelink.class.inc
+
+; Module dependencies
+; dependencies[] = mymodule
+; dependencies[] = theirmodule (1.2)
+; dependencies[] = anothermodule (>=2.4)
+; dependencies[] = views (3.x)
+
+; Configuration page
+; configure = admin/config/contentsadminrelink
+
+
+; For further information about configuration options, see
+; - http://drupal.org/node/542202

+ 134 - 0
sites/all/modules/gui/contentsadminrelink/contentsadminrelink.module

@@ -0,0 +1,134 @@
+<?php
+/**
+ * @file
+ * This is the file description for Contentsadminrelink module.
+ *
+ * In this more verbose, multi-line description, you can specify what this
+ * file does exactly. Make sure to wrap your documentation in column 78 so
+ * that the file can be displayed nicely in default-sized consoles.
+ */
+
+/**
+ * Implements hook_menu().
+ */
+function contentsadminrelink_menu() {
+  $items = array();
+  return $items;
+}
+
+
+/**
+ * Implements hook_url_outbound_alter().
+ */
+# useless, just play with perms and menu_alter
+// function contentsadminrelink_url_outbound_alter(&$path, &$options, $original_path) {
+  // if ($path == 'admin/content' || $path == 'admin/content/node') { 
+  //   $path = 'admin/content/nodes';
+  // }
+//}
+
+/**
+ * Implements hook_permission().
+ */
+function contentsadminrelink_permission() {
+  return array(
+    'access core content overview' =>  array(
+      'title' => t('Access core content overview'),
+      // 'description' => t('Perform administration tasks for my module.'),
+    ),
+    'access core media overview' =>  array(
+      'title' => t('Access classic media overview'),
+      // 'description' => t('Perform administration tasks for my module.'),
+    ),
+
+  );
+}
+
+/**
+ * Implements hook_menu_alter().
+ */
+function contentsadminrelink_menu_alter(&$items) {
+	// dsm($items, '$items');
+	if(isset($items['admin/content']))
+		$items['admin/content']['access arguments'] = array('access core content overview');
+
+	if(isset($items['admin/content/node']))
+		$items['admin/content/node']['access arguments'] = array('access core content overview');
+
+	if(isset($items['admin/content/media']))
+		$items['admin/content/media']['access arguments'] = array('access classic media overview');
+	
+	// dsm($items, '$items');
+}
+
+/**
+ * Implements hook_menu_local_tasks_alter().
+ */
+function contentsadminrelink_menu_local_tasks_alter(&$data, $router_item, $root_path) {
+  switch($root_path){  
+    case 'admin/content/nodes' : // for example 'page/view/news'
+      $item = menu_get_item('node/add'); 
+      if ($item['access']) {       
+        $data['actions']['output'][] = array(
+          '#theme' => 'menu_local_action',
+          '#link' => $item,
+        );
+      }
+    break;  
+    case 'admin/content/materiaux' :
+      $item = menu_get_item('node/add/materiau'); 
+      if ($item['access']) {       
+        $data['actions']['output'][] = array(
+          '#theme' => 'menu_local_action',
+          '#link' => $item,
+        );
+      }
+      $item = menu_get_item('node/add/breve'); 
+      if ($item['access']) {       
+        $data['actions']['output'][] = array(
+          '#theme' => 'menu_local_action',
+          '#link' => $item,
+        );
+      }
+
+    break; 
+    case 'admin/content/companies' :
+      $item = menu_get_item('node/add/company'); 
+      if ($item['access']) {       
+        $data['actions']['output'][] = array(
+          '#theme' => 'menu_local_action',
+          '#link' => $item,
+        );
+      }
+      $item = menu_get_item('admin/people/create'); 
+      if ($item['access']) {       
+        $data['actions']['output'][] = array(
+          '#theme' => 'menu_local_action',
+          '#link' => $item,
+        );
+      }
+
+    break;  
+    case 'admin/users' :
+      $item = menu_get_item('admin/people/create'); 
+      if ($item['access']) {       
+        $data['actions']['output'][] = array(
+          '#theme' => 'menu_local_action',
+          '#link' => $item,
+        );
+      }
+    break;  
+		
+    // case 'admin/content/medias' : // for example 'page/view/news'
+    //   $item = menu_get_item('admin/content/media/import'); 
+    //   if ($item['access']) {       
+    //     $data['actions']['output'][] = array(
+    //       '#theme' => 'menu_local_action',
+    //       '#link' => $item,
+    //     );
+    //   }
+    // break;  
+		
+  }  
+
+}

BIN
sites/all/modules/gui/contentsadminrelink/icon.png