Parcourir la source

commited custom modules for showroom release

Bachir Soussi Chiadmi il y a 7 ans
Parent
commit
026a9bc241

+ 31 - 1
sites/all/modules/gui/materiobasemod/materio_showroom.module

@@ -259,6 +259,8 @@ function materio_showroom_form_field_ui_field_edit_form_alter(&$form, &$form_sta
  * Implements hook_form_alter().
  */
 function materio_showroom_form_alter(&$form, &$form_state, $form_id) {
+  // dsm($form_id);
+
   // act only on node edit form
   if(isset($form['#node_edit_form'])){
     // dsm($form_id, 'form_id');
@@ -267,6 +269,7 @@ function materio_showroom_form_alter(&$form, &$form_state, $form_id) {
 
     _materio_showroom_alter_location_field_form($form, $form_state, $form_id);
   }
+
 }
 
 function _materio_showroom_alter_location_field_form(&$form, &$form_state, $form_id){
@@ -385,6 +388,33 @@ function materio_showroom_permission() {
   );
 }
 
+
+/**
+ * Implements hook_menu_local_tasks_alter().
+ */
+function materio_showroom_menu_local_tasks_alter(&$data, $router_item, $root_path) {
+  switch($root_path){
+    case 'admin/content/showrooms' :
+      $item = menu_get_item('node/add/showroom');
+      if ($item['access']) {
+        $data['actions']['output'][] = array(
+          '#theme' => 'menu_local_action',
+          '#link' => $item,
+        );
+      }
+      // TODO: prepopulate user role and showroom taxo (https://www.drupal.org/project/prepopulate)
+      // $item = menu_get_item('admin/people/create');
+      // if ($item['access']) {
+      //   $data['actions']['output'][] = array(
+      //     '#theme' => 'menu_local_action',
+      //     '#link' => $item,
+      //   );
+      // }
+
+      break;
+  }
+}
+
 //     __  ____                  __  _
 //    /  |/  (_)___ __________ _/ /_(_)___  ____
 //   / /|_/ / / __ `/ ___/ __ `/ __/ / __ \/ __ \
@@ -434,7 +464,7 @@ function materio_showroom_migrate_location_fields_settings_form(){
     '#type'=>'select',
     '#options'=>$nt_options,
     '#default_value' => $node_type,
-    '#title' => t('source field (must be a text field)'),
+    '#title' => t('Content type'),
     '#multiple' => false,
   );
 

+ 30 - 9
sites/all/modules/gui/materiobasemod/materio_translator.module

@@ -26,15 +26,36 @@
 /**
  * Implements hook_form_alter().
  */
-function materio_translator_form_alter(&$form, &$form_state, $form_id) {
-  // dsm($form_id);
-  if( $form_id == "materiau_node_form" ){
-    dsm($form);
-    // $form['account']['pass']['#type'] = 'password';
-    // $form['account']['pass']['#title'] = t('Password');
-    //
-    // $form['actions']['#type'] = "container";
-    // $form['actions']['submit']['#value'] = t('Join');
+function DISABLED_materio_translator_form_alter(&$form, &$form_state, $form_id) {
+  // act only on node edit form
+  if(isset($form['#node_edit_form'])){
+    // dsm($form_id, 'form_id');
+    // dsm($form, 'form');
+    // dsm($form_state, 'form_state');
+
   }
 
 }
+
+/**
+ * Implements hook_field_access().
+ */
+function DISABLED_materio_translator_field_access($op, $field, $entity_type, $entity, $account) {
+  // dsm($op,'op');
+  // dsm($entity_type,'entity_type');
+  // if($op == "edit" && $entity_type == 'node'){
+  //   if($field['translatable'] == 0){
+  //     if($field['field_permissions']['type'] == FIELD_PERMISSIONS_CUSTOM){
+  //       dsm($field,$field['field_name']);
+  //       // dsm($entity,'entity');
+  //       // dsm($account,'account');
+  //
+  //       // check if field permissions are handled by field_permissions module
+  //
+  //       // return FALSE;
+  //     }
+  //   }
+  // }
+  //
+  // return TRUE;
+}