with last commit: contrib field_collection mod & custom showroom et translator mods
This commit is contained in:
23
sites/all/modules/gui/materiobasemod/materio_showroom.info
Normal file
23
sites/all/modules/gui/materiobasemod/materio_showroom.info
Normal file
@@ -0,0 +1,23 @@
|
||||
name = Materio Showroom
|
||||
description = "Materio showroom dedicated module"
|
||||
|
||||
; Core version (required)
|
||||
core = 7.x
|
||||
|
||||
; Package name (see http://drupal.org/node/542202 for a list of names)
|
||||
package = Materio
|
||||
|
||||
; PHP version requirement (optional)
|
||||
; php = 5.2
|
||||
|
||||
; Loadable code files
|
||||
; files[] = materio_ctools_automodal.module
|
||||
|
||||
; Module dependencies
|
||||
dependencies[] = user
|
||||
|
||||
; Configuration page
|
||||
; configure = admin/config/materiobasemod
|
||||
|
||||
; For further information about configuration options, see
|
||||
; - http://drupal.org/node/542202
|
86
sites/all/modules/gui/materiobasemod/materio_showroom.module
Normal file
86
sites/all/modules/gui/materiobasemod/materio_showroom.module
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_init().
|
||||
*/
|
||||
// function materio_showroom_init() {
|
||||
// drupal_add_js(drupal_get_path('module', 'materio_showroom').'/js/materio_showroom.js');
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_permission().
|
||||
*/
|
||||
// function materio_showroom_permission() {
|
||||
// $perms = array(
|
||||
// 'add showroom localisation' => array(
|
||||
// 'title' => t('add showroom localisation'),
|
||||
// 'description' => t('add showroom localisation'),
|
||||
// ),
|
||||
// );
|
||||
//
|
||||
// return $perms;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Acts on a field collection item being inserted or updated.
|
||||
*
|
||||
* This hook is invoked before the field collection item is saved to the database.
|
||||
*
|
||||
* @param FieldCollectionItemEntity $field_collection_item
|
||||
* The field collection item that is being inserted or updated.
|
||||
*
|
||||
* @see hook_entity_presave()
|
||||
*/
|
||||
function materio_showroom_entity_presave($entity, $type) {
|
||||
// dsm($type);
|
||||
if ($type == 'field_collection_item' && $entity->field_name == 'field_showroom_localisation') {
|
||||
// dsm($entity);
|
||||
|
||||
global $user;
|
||||
$user = user_load($user->uid); // Make sure the user object is fully loaded
|
||||
// dsm($user);
|
||||
if(isset($entity->field_showroom_localisation_loca[LANGUAGE_NONE])){
|
||||
|
||||
$user_showroom = $user->field_showroom[LANGUAGE_NONE][0]['tid'];
|
||||
// dsm($user_showroom);
|
||||
|
||||
foreach ($entity->field_showroom_localisation_loca[LANGUAGE_NONE] as $i => $loca) {
|
||||
if(empty($entity->field_showroom_localisation_show)){
|
||||
$entity->field_showroom_localisation_show[LANGUAGE_NONE] = [];
|
||||
}
|
||||
if(empty($entity->field_showroom_localisation_show[LANGUAGE_NONE])){
|
||||
$entity->field_showroom_localisation_show[LANGUAGE_NONE][] = [];
|
||||
}
|
||||
dsm($entity->field_showroom_localisation_show);
|
||||
|
||||
if(!isset($entity->original->field_showroom_localisation_show[LANGUAGE_NONE][$i]['tid'])){
|
||||
$tid = $user_showroom;
|
||||
}else{
|
||||
$tid = $entity->original->field_showroom_localisation_show[LANGUAGE_NONE][$i]['tid'];
|
||||
}
|
||||
dsm($tid);
|
||||
$entity->field_showroom_localisation_show[LANGUAGE_NONE][$i]['tid'] = $tid;
|
||||
dsm($entity->field_showroom_localisation_show);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_form_alter().
|
||||
*/
|
||||
// function materio_showroom_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');
|
||||
// }
|
||||
//
|
||||
// }
|
23
sites/all/modules/gui/materiobasemod/materio_translator.info
Normal file
23
sites/all/modules/gui/materiobasemod/materio_translator.info
Normal file
@@ -0,0 +1,23 @@
|
||||
name = Materio Tranlator
|
||||
description = "Materio translator dedicated module"
|
||||
|
||||
; Core version (required)
|
||||
core = 7.x
|
||||
|
||||
; Package name (see http://drupal.org/node/542202 for a list of names)
|
||||
package = Materio
|
||||
|
||||
; PHP version requirement (optional)
|
||||
; php = 5.2
|
||||
|
||||
; Loadable code files
|
||||
; files[] = materio_ctools_automodal.module
|
||||
|
||||
; Module dependencies
|
||||
dependencies[] = user
|
||||
|
||||
; Configuration page
|
||||
; configure = admin/config/materiobasemod
|
||||
|
||||
; For further information about configuration options, see
|
||||
; - http://drupal.org/node/542202
|
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_init().
|
||||
*/
|
||||
// function materio_translator_init() {
|
||||
// drupal_add_js(drupal_get_path('module', 'materio_translator').'/js/materio_translator.js');
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_permission().
|
||||
*/
|
||||
// function materio_translator_permission() {
|
||||
// $perms = array(
|
||||
// 'add showroom localisation' => array(
|
||||
// 'title' => t('add showroom localisation'),
|
||||
// 'description' => t('add showroom localisation'),
|
||||
// ),
|
||||
// );
|
||||
//
|
||||
// return $perms;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user