Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73ec6d3c1e | ||
|
|
dee5085c89 | ||
|
|
c4ab89f177 | ||
|
|
d1b069ad8b | ||
|
|
c56a523286 |
+1
-3
@@ -890,10 +890,8 @@ function materio_administration_views_default_views() {
|
||||
$handler->display->display_options['fields']['field_tags_libres']['id'] = 'field_tags_libres';
|
||||
$handler->display->display_options['fields']['field_tags_libres']['table'] = 'field_data_field_tags_libres';
|
||||
$handler->display->display_options['fields']['field_tags_libres']['field'] = 'field_tags_libres';
|
||||
$handler->display->display_options['fields']['field_tags_libres']['type'] = 'i18n_taxonomy_term_reference_plain';
|
||||
$handler->display->display_options['fields']['field_tags_libres']['delta_limit'] = '4';
|
||||
$handler->display->display_options['fields']['field_tags_libres']['delta_limit'] = '0';
|
||||
$handler->display->display_options['fields']['field_tags_libres']['delta_offset'] = '0';
|
||||
$handler->display->display_options['fields']['field_tags_libres']['multi_type'] = 'ul';
|
||||
/* Field: Content: Materiau(x) lié(s) */
|
||||
$handler->display->display_options['fields']['field_materiau_ref']['id'] = 'field_materiau_ref';
|
||||
$handler->display->display_options['fields']['field_materiau_ref']['table'] = 'field_data_field_materiau_ref';
|
||||
|
||||
+11
-11
@@ -2394,7 +2394,7 @@ function materio_content_types_field_default_field_instances() {
|
||||
'label' => 'hidden',
|
||||
'settings' => array(),
|
||||
'type' => 'hidden',
|
||||
'weight' => 15,
|
||||
'weight' => 16,
|
||||
),
|
||||
'cardsmall' => array(
|
||||
'label' => 'above',
|
||||
@@ -2489,7 +2489,7 @@ function materio_content_types_field_default_field_instances() {
|
||||
'viewmode' => 'cardmedium',
|
||||
),
|
||||
'type' => 'tode',
|
||||
'weight' => 10,
|
||||
'weight' => 23,
|
||||
),
|
||||
'cardsmall' => array(
|
||||
'label' => 'above',
|
||||
@@ -2586,7 +2586,7 @@ function materio_content_types_field_default_field_instances() {
|
||||
'viewmode' => 'cardmedium',
|
||||
),
|
||||
'type' => 'tode',
|
||||
'weight' => 9,
|
||||
'weight' => 22,
|
||||
),
|
||||
'cardsmall' => array(
|
||||
'label' => 'above',
|
||||
@@ -2763,7 +2763,7 @@ function materio_content_types_field_default_field_instances() {
|
||||
'label' => 'above',
|
||||
'settings' => array(),
|
||||
'type' => 'hidden',
|
||||
'weight' => 10,
|
||||
'weight' => 11,
|
||||
),
|
||||
'cardsmall' => array(
|
||||
'label' => 'above',
|
||||
@@ -2844,7 +2844,7 @@ function materio_content_types_field_default_field_instances() {
|
||||
'label' => 'above',
|
||||
'settings' => array(),
|
||||
'type' => 'hidden',
|
||||
'weight' => 11,
|
||||
'weight' => 12,
|
||||
),
|
||||
'cardsmall' => array(
|
||||
'label' => 'above',
|
||||
@@ -2924,7 +2924,7 @@ function materio_content_types_field_default_field_instances() {
|
||||
'label' => 'hidden',
|
||||
'settings' => array(),
|
||||
'type' => 'hidden',
|
||||
'weight' => 16,
|
||||
'weight' => 17,
|
||||
),
|
||||
'cardsmall' => array(
|
||||
'label' => 'hidden',
|
||||
@@ -3219,7 +3219,7 @@ function materio_content_types_field_default_field_instances() {
|
||||
'label' => 'above',
|
||||
'settings' => array(),
|
||||
'type' => 'hidden',
|
||||
'weight' => 13,
|
||||
'weight' => 14,
|
||||
),
|
||||
'cardsmall' => array(
|
||||
'label' => 'above',
|
||||
@@ -3395,7 +3395,7 @@ function materio_content_types_field_default_field_instances() {
|
||||
'label' => 'above',
|
||||
'settings' => array(),
|
||||
'type' => 'hidden',
|
||||
'weight' => 12,
|
||||
'weight' => 13,
|
||||
),
|
||||
'cardsmall' => array(
|
||||
'label' => 'above',
|
||||
@@ -3574,7 +3574,7 @@ Vous devez avant d\'utiliser un nouveau tag le créer <a href="/admin/structure/
|
||||
'label' => 'above',
|
||||
'settings' => array(),
|
||||
'type' => 'hidden',
|
||||
'weight' => 14,
|
||||
'weight' => 15,
|
||||
),
|
||||
'cardsmall' => array(
|
||||
'label' => 'above',
|
||||
@@ -3660,7 +3660,7 @@ Vous devez avant d\'utiliser un nouveau tag le créer <a href="/admin/structure/
|
||||
'label' => 'hidden',
|
||||
'settings' => array(),
|
||||
'type' => 'hidden',
|
||||
'weight' => 8,
|
||||
'weight' => 9,
|
||||
),
|
||||
'cardsmall' => array(
|
||||
'label' => 'above',
|
||||
@@ -3743,7 +3743,7 @@ Vous devez avant d\'utiliser un nouveau tag le créer <a href="/admin/structure/
|
||||
'label' => 'above',
|
||||
'settings' => array(),
|
||||
'type' => 'hidden',
|
||||
'weight' => 9,
|
||||
'weight' => 10,
|
||||
),
|
||||
'cardsmall' => array(
|
||||
'label' => 'above',
|
||||
|
||||
+7
-1
@@ -1151,6 +1151,7 @@ function materio_content_types_user_default_permissions() {
|
||||
$permissions['view field_materiau_image'] = array(
|
||||
'name' => 'view field_materiau_image',
|
||||
'roles' => array(
|
||||
'anonymous user' => 'anonymous user',
|
||||
'authenticated user' => 'authenticated user',
|
||||
),
|
||||
'module' => 'field_permissions',
|
||||
@@ -1272,7 +1273,12 @@ function materio_content_types_user_default_permissions() {
|
||||
// Exported permission: 'view field_tags_libres'.
|
||||
$permissions['view field_tags_libres'] = array(
|
||||
'name' => 'view field_tags_libres',
|
||||
'roles' => array(),
|
||||
'roles' => array(
|
||||
'Admin showroom' => 'Admin showroom',
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'field_permissions',
|
||||
);
|
||||
|
||||
|
||||
+1
-1
@@ -412,7 +412,7 @@ function materio_content_types_strongarm() {
|
||||
'workflow' => array(
|
||||
'cardmedium' => array(
|
||||
'weight' => '8',
|
||||
'visible' => TRUE,
|
||||
'visible' => FALSE,
|
||||
),
|
||||
'cardbig' => array(
|
||||
'weight' => '15',
|
||||
|
||||
@@ -210,10 +210,22 @@ function showroom_user_default_permissions() {
|
||||
'module' => 'override_node_options',
|
||||
);
|
||||
|
||||
// Exported permission: 'materio showroom edit all samples fields'.
|
||||
$permissions['materio showroom edit all samples fields'] = array(
|
||||
'name' => 'materio showroom edit all samples fields',
|
||||
'roles' => array(
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'materio_showroom',
|
||||
);
|
||||
|
||||
// Exported permission: 'materio showroom migrate fields'.
|
||||
$permissions['materio showroom migrate fields'] = array(
|
||||
'name' => 'materio showroom migrate fields',
|
||||
'roles' => array(),
|
||||
'roles' => array(
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'materio_showroom',
|
||||
);
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ features[user_permission][] = edit own showroom content
|
||||
features[user_permission][] = edit terms in showroom
|
||||
features[user_permission][] = edit users with role 13
|
||||
features[user_permission][] = enter showroom revision log entry
|
||||
features[user_permission][] = materio showroom edit all samples fields
|
||||
features[user_permission][] = materio showroom migrate fields
|
||||
features[user_permission][] = merge showroom terms
|
||||
features[user_permission][] = override showroom authored by option
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* @file
|
||||
* Javascript for materio showroom field location.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Disable draggable behaviour for the field.
|
||||
*/
|
||||
(function ($) {
|
||||
Drupal.behaviors.field_materio_showroom_location = {
|
||||
attach: function(context) {
|
||||
// console.log('hello materio_showroom');
|
||||
$(".field-multiple-drag", ".field-type-field-materio-showroom-location").hide();
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
@@ -18,6 +18,10 @@ function materio_admin_permission() {
|
||||
'title' => t('access duplicate mails list'),
|
||||
'description' => t('access duplicate mails list.'),
|
||||
),
|
||||
'materio admin fix term reference field' => array(
|
||||
'title' => t('Materio admin fix term reference field'),
|
||||
'description' => t('Materio admin fix term reference field.'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,23 +38,10 @@ function materio_admin_menu() {
|
||||
'type' => MENU_LOCAL_TASK
|
||||
);
|
||||
|
||||
|
||||
|
||||
if(module_exists('simplenews')){
|
||||
$cats = simplenews_category_list();
|
||||
// dsm($cats, 'cats');
|
||||
foreach ($cats as $tid => $name) {
|
||||
// $items['node/%node/simplenews'] = array(
|
||||
// 'title' => 'Newsletter',
|
||||
// 'type' => MENU_LOCAL_TASK,
|
||||
// 'access callback' => 'simplenews_node_tab_access',
|
||||
// 'access arguments' => array(1),
|
||||
// 'page callback' => 'simplenews_node_tab_page',
|
||||
// 'page arguments' => array(1),
|
||||
// 'context' => MENU_LOCAL_TASK,
|
||||
// 'file' => 'includes/simplenews.admin.inc',
|
||||
// 'weight' => 2,
|
||||
// );
|
||||
$items['node/add/simplenews/'.$tid] = array(
|
||||
'title' => $name,
|
||||
'title callback' => 'check_plain',
|
||||
@@ -63,6 +54,23 @@ function materio_admin_menu() {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// fix term ref field lost with taxonomy
|
||||
$items['admin/config/content/materio'] = array(
|
||||
'title' => 'Materio',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('materio_admin_fix_termref_fields_form'),
|
||||
'access arguments' => array('materio admin fix term reference field'),
|
||||
'type' => MENU_NORMAL_ITEM,
|
||||
);
|
||||
|
||||
$items['admin/config/content/materio/fix_termref_fields'] = array(
|
||||
'title' => 'Fix term reference field from taxonomy',
|
||||
'type' => MENU_DEFAULT_LOCAL_TASK,
|
||||
);
|
||||
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
@@ -106,6 +114,242 @@ function materio_duplicatemails(){
|
||||
return $output;
|
||||
}
|
||||
|
||||
function materio_admin_fix_termref_fields_form(){
|
||||
drupal_set_title('Fix term reference fields', PASS_THROUGH);
|
||||
|
||||
$types = node_type_get_types();
|
||||
// dsm($types, 'types');
|
||||
$nt_options = array();
|
||||
foreach ($types as $mn => $type) {
|
||||
$nt_options[$mn] = $type->name;
|
||||
}
|
||||
|
||||
$node_type = variable_get('materio_admin_fix_termref_node_type', null);
|
||||
// source field (must be a text field)
|
||||
$form['node_type'] = array(
|
||||
'#type'=>'select',
|
||||
'#options'=>$nt_options,
|
||||
'#default_value' => $node_type,
|
||||
'#title' => t('Content type'),
|
||||
'#multiple' => false,
|
||||
);
|
||||
|
||||
if($node_type){
|
||||
|
||||
$fieldsmap = field_info_field_map();
|
||||
$target_options = array();
|
||||
foreach ($fieldsmap as $field_name => $field) {
|
||||
// dsm($field, $field_name);
|
||||
if ($field['type'] == 'taxonomy_term_reference'
|
||||
&& isset($field['bundles']['node'])
|
||||
&& in_array($node_type, $field['bundles']['node'])) {
|
||||
$target_options[$field_name] = $field_name;
|
||||
}
|
||||
}
|
||||
|
||||
$target_field = variable_get('materio_admin_fix_termref_target_field', null);
|
||||
// target field (must be a entity_reference field)
|
||||
$form['target_field'] = array(
|
||||
'#type'=>'select',
|
||||
'#options'=>$target_options,
|
||||
'#default_value' => $target_field,
|
||||
'#title' => t('target field (must be a term_reference field)'),
|
||||
'#multiple' => false,
|
||||
);
|
||||
|
||||
if($target_field){
|
||||
// retrive various field infos
|
||||
$field_info = field_info_field($target_field);
|
||||
// dsm($field_info, 'field_info');
|
||||
// $field_instance = field_info_instance('node', $target_field, $node_type);
|
||||
// dsm($field_instance, 'field_instance');
|
||||
|
||||
$voc_name = $field_info['settings']['allowed_values'][0]['vocabulary'];
|
||||
$vid = taxonomy_vocabulary_machine_name_load($voc_name)->vid;
|
||||
$voc = taxonomy_vocabulary_load($vid);
|
||||
$tree = taxonomy_get_tree($vid);
|
||||
// dsm($tree, 'tree');
|
||||
foreach ($tree as $key => $term) {
|
||||
$terms[$term->tid] = $term->name;
|
||||
}
|
||||
|
||||
|
||||
$src_term = variable_get('materio_admin_fix_termref_src_term', null);
|
||||
// src term
|
||||
$form['src_term'] = array(
|
||||
'#type'=>'select',
|
||||
'#options'=>$terms,
|
||||
'#default_value' => $src_term,
|
||||
'#title' => t('source term'),
|
||||
'#multiple' => false,
|
||||
);
|
||||
|
||||
if($src_term){
|
||||
|
||||
$form['txt_nids'] = array(
|
||||
'#type'=>'textarea',
|
||||
'#title' => t('nids to fix'),
|
||||
'#description' => t('comma separated nids list'),
|
||||
);
|
||||
|
||||
|
||||
$form['fixterms'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => 'Fixterms',
|
||||
);
|
||||
|
||||
// $nodes = taxonomy_select_nodes($src_term, false);
|
||||
// dsm($nodes, 'nodes');
|
||||
// $src_items = field_get_items('node', node_load(11858), $target_field);
|
||||
// dsm($src_items);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$form['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => 'Save',
|
||||
// '#submit' => array('materio_showroom_migrate_location_fields_migrate'),
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
function materio_admin_fix_termref_fields_form_submit($form, &$form_state){
|
||||
// dsm($form_state, 'form_state');
|
||||
|
||||
$node_type = $form_state['values']['node_type']; $context['results']['field_migrated']++;
|
||||
$target_field = $form_state['values']['target_field'];
|
||||
$src_term = $form_state['values']['src_term'];
|
||||
|
||||
variable_set('materio_admin_fix_termref_node_type', $node_type);
|
||||
variable_set('materio_admin_fix_termref_target_field', $target_field);
|
||||
variable_set('materio_admin_fix_termref_src_term', $src_term);
|
||||
|
||||
$nids = explode(',', $form_state['values']['txt_nids']);
|
||||
|
||||
if ($form_state['values']['op'] == 'Fixterms' && !empty($nids)){
|
||||
_materio_admin_batch_fixterm_ref($node_type, $target_field, $src_term, $nids);
|
||||
}
|
||||
}
|
||||
|
||||
function _materio_admin_batch_fixterm_ref($node_type, $target_field, $src_tid, $nids){
|
||||
// Reset counter for debug information.
|
||||
$_SESSION['http_request_count'] = 0;
|
||||
|
||||
$batch = array(
|
||||
'title' => t('Fixing ref terms ...'),
|
||||
'operations' => array(),
|
||||
'init_message' => t('Commencing'),
|
||||
'progress_message' => t('Processed @current out of @total.'),
|
||||
'error_message' => t('An error occurred during processing'),
|
||||
'finished' => '_materio_admin_batch_fixterm_ref_finished',
|
||||
);
|
||||
|
||||
foreach ($nids as $nid) {
|
||||
$nid = trim($nid);
|
||||
$batch['operations'][] = array(
|
||||
'_materio_admin_batch_fixterm_ref_op',
|
||||
array(
|
||||
$nid,
|
||||
$src_tid, $target_field,
|
||||
$node_type,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
batch_set($batch);
|
||||
}
|
||||
|
||||
function _materio_admin_batch_fixterm_ref_op($nid, $src_tid, $target_field, $node_type){
|
||||
$context['results']['field_migrated']++;
|
||||
|
||||
$node = node_load($nid);
|
||||
if($node->type == $node_type){
|
||||
$items = field_get_items('node', $node, $target_field);
|
||||
foreach ($items as $key => $item) {
|
||||
$flat_items[] = $item['tid'];
|
||||
}
|
||||
if(!in_array($src_tid, $flat_items)){
|
||||
// $items[] = array('tid'=>$src_tid);
|
||||
$node->{$target_field}[LANGUAGE_NONE][] = array('tid'=>$src_tid);
|
||||
}
|
||||
node_save($node);
|
||||
}
|
||||
|
||||
//Simply show the import row count.
|
||||
$context['message'] = t('Migrating node !c : %title (%nid)', array(
|
||||
'!c' => $context['results']['field_migrated'],
|
||||
'%title'=>$node->title,
|
||||
'%nid'=>$nid ));
|
||||
|
||||
// In order to slow importing and debug better,
|
||||
// we can uncomment this line to make each import slightly slower.
|
||||
// usleep(2500);
|
||||
|
||||
if ( false ) {
|
||||
$context['results']['failed_nodes'][] = $nid ;
|
||||
}
|
||||
|
||||
_materio_admin_update_http_requests();
|
||||
|
||||
}
|
||||
|
||||
function _materio_admin_batch_fixterm_ref_finished($success, $results, $operations){
|
||||
// dsm($success, 'success');
|
||||
// dsm($results, 'results');
|
||||
// dsm($operations, 'operations');
|
||||
if ($success) {
|
||||
// Here we could do something meaningful with the results.
|
||||
// We just display the number of nodes we processed...
|
||||
drupal_set_message(t('@count results processed in @requests HTTP requests.', array('@count' => count($results), '@requests' => _materio_admin_get_http_requests())));
|
||||
drupal_set_message(t('The final result was "%final"', array('%final' => end($results))));
|
||||
}
|
||||
else {
|
||||
// An error occurred.
|
||||
// $operations contains the operations that remained unprocessed.
|
||||
drupal_set_message(
|
||||
t('operations : @args',
|
||||
array(
|
||||
'@args' => print_r(current($operations), TRUE),
|
||||
)
|
||||
),
|
||||
'error'
|
||||
);
|
||||
$error_operation = reset($operations);
|
||||
drupal_set_message(
|
||||
t('An error occurred while processing @operation with arguments : @args',
|
||||
array(
|
||||
'@operation' => $error_operation[0],
|
||||
'@args' => print_r($error_operation[0], TRUE),
|
||||
)
|
||||
),
|
||||
'error'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Utility function to increment HTTP requests in a session variable.
|
||||
*/
|
||||
function _materio_admin_update_http_requests() {
|
||||
$_SESSION['http_request_count']++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function to count the HTTP requests in a session variable.
|
||||
*
|
||||
* @return int
|
||||
* Number of requests.
|
||||
*/
|
||||
function _materio_admin_get_http_requests() {
|
||||
return !empty($_SESSION['http_request_count']) ? $_SESSION['http_request_count'] : 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_menu_alter().
|
||||
*/
|
||||
|
||||
@@ -182,16 +182,13 @@ function materio_showroom_field_widget_info() {
|
||||
* 'rgb' form element.
|
||||
*/
|
||||
function materio_showroom_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
|
||||
$locval = isset($items[$delta]['location']) ? $items[$delta]['location'] : '';
|
||||
$showroom_tid = isset($items[$delta]['showroom_tid']) ? $items[$delta]['showroom_tid'] : 0;
|
||||
|
||||
$widget = $element;
|
||||
$widget['#delta'] = $delta;
|
||||
|
||||
switch ($instance['widget']['type']) {
|
||||
// TODO: loop through showrooms and don't allow more than one field by show room
|
||||
|
||||
case 'materio_showroom_location_text':
|
||||
case 'materio_showroom_location_text':
|
||||
$locval = isset($items[$delta]['location']) ? $items[$delta]['location'] : '';
|
||||
$showroom_tid = isset($items[$delta]['showroom_tid']) ? $items[$delta]['showroom_tid'] : 0;
|
||||
|
||||
$widget['showroom_tid'] = array(
|
||||
'#type' => 'hidden',
|
||||
@@ -211,6 +208,11 @@ function materio_showroom_field_widget_form(&$form, &$form_state, $field, $insta
|
||||
'#maxlength' => 255,
|
||||
);
|
||||
|
||||
$widget['#attached'] = array(
|
||||
// Add javascript to remove the draggable behaviour.
|
||||
'js' => array(drupal_get_path('module', 'materio_showroom') . '/js/materio_showroom.js'),
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -279,6 +281,8 @@ function _materio_showroom_alter_location_field_form(&$form, &$form_state, $form
|
||||
$node = $form['#node'];
|
||||
$nodetype = $form['type']['#value'];
|
||||
|
||||
// dsm($form_state, 'form_state');
|
||||
|
||||
global $user;
|
||||
$user = user_load($user->uid); // Make sure the user object is fully loaded
|
||||
// dsm($user, 'user');
|
||||
@@ -311,13 +315,14 @@ function _materio_showroom_alter_location_field_form(&$form, &$form_state, $form
|
||||
foreach ($showroomfieldinstances as $field_name) {
|
||||
// retrive various field infos
|
||||
$field_info = field_info_field($field_name);
|
||||
$field_instance = field_info_instance('node', $field_name, $nodetype);
|
||||
// dsm($field_info, 'field_info');
|
||||
$field_instance = field_info_instance('node', $field_name, $nodetype);
|
||||
|
||||
// get all terms from chosen vocabulary in field instance widget settings
|
||||
$vid = $field_instance['widget']['settings']['vocabulary'];
|
||||
$voc = taxonomy_vocabulary_load($vid);
|
||||
$tree = taxonomy_get_tree($vid);
|
||||
// dsm($tree, 'tree');
|
||||
foreach ($tree as $key => $term) {
|
||||
$terms[$term->tid] = $term->name;
|
||||
}
|
||||
@@ -334,44 +339,58 @@ function _materio_showroom_alter_location_field_form(&$form, &$form_state, $form
|
||||
|
||||
// get already recorded values
|
||||
$old_items = field_get_items('node', $node, $field_name);
|
||||
// dsm($old_items, 'old_items');
|
||||
foreach ($old_items as $i => $value) {
|
||||
$values[$value['showroom_tid']] = $value['location'];
|
||||
}
|
||||
// dsm($values, 'values');
|
||||
|
||||
// build new item list
|
||||
foreach ($terms as $tid => $name) {
|
||||
$items[] = array(
|
||||
'showroom_tid' => $tid,
|
||||
'location' => isset($values[$tid]) ? $values[$tid] : ''
|
||||
);
|
||||
}
|
||||
// for ($k=0; $k < 3; $k++) {
|
||||
foreach ($terms as $tid => $name) {
|
||||
$items[] = array(
|
||||
'showroom_tid' => "$tid",
|
||||
'location' => isset($values[$tid]) ? $values[$tid] : ''
|
||||
);
|
||||
}
|
||||
// }
|
||||
// dsm($items, 'items');
|
||||
|
||||
// change form_state items count
|
||||
// without this, form wont populated with all wanted items
|
||||
$form_state['field'][$field_name][LANGUAGE_NONE]['items_count'] = count($items);
|
||||
|
||||
// retrieve new field form with our custom items
|
||||
$new_field_form = field_default_form('node', $node, $field_info, $field_instance, LANGUAGE_NONE, $items, $form, $form_state);
|
||||
// dsm($new_field_form, 'default_form');
|
||||
$new_field_form = field_default_form('node', null, $field_info, $field_instance, LANGUAGE_NONE, $items, $form, $form_state)[$field_name];
|
||||
// dsm($new_field_form, 'new_field_form');
|
||||
|
||||
|
||||
// $elements = field_multiple_value_form($field_info, $field_instance, LANGUAGE_NONE, $items, $form, $form_state);
|
||||
// dsm($elements, 'elements');
|
||||
|
||||
|
||||
// change items location field title
|
||||
// and check access comparing term id with user taged with
|
||||
$i = 0;
|
||||
foreach ($terms as $tid => $name) {
|
||||
$item = $new_field_form[$field_name][LANGUAGE_NONE][$i];
|
||||
$new_field_form[$field_name][LANGUAGE_NONE][$i]['location']['#title'] = $terms[$item['showroom_tid']['#default_value']];
|
||||
$item = $new_field_form[LANGUAGE_NONE][$i];
|
||||
$new_field_form[LANGUAGE_NONE][$i]['location']['#title'] = $terms[$item['showroom_tid']['#default_value']];
|
||||
$disabled = !user_access('materio showroom edit all samples fields', $user) && !in_array($tid, $user_showrooms);
|
||||
$new_field_form[$field_name][LANGUAGE_NONE][$i]['location']['#disabled'] = $disabled;
|
||||
$new_field_form[LANGUAGE_NONE][$i]['location']['#disabled'] = $disabled;
|
||||
$i++;
|
||||
}
|
||||
|
||||
// remove the last one more item added by default
|
||||
unset($new_field_form[$field_name][LANGUAGE_NONE][$i]);
|
||||
unset($new_field_form[LANGUAGE_NONE][$i]);
|
||||
|
||||
// remove "add more" button
|
||||
unset($new_field_form[LANGUAGE_NONE]['add_more']);
|
||||
|
||||
// dsm($new_field_form, 'new_field_form');
|
||||
|
||||
// delete normal field form and replace it with our new custom field form
|
||||
unset($form[$field_name]);
|
||||
$form[$field_name] = $new_field_form[$field_name];
|
||||
|
||||
// remove "add more" button
|
||||
unset($form[$field_name]['und']['add_more']);
|
||||
$form[$field_name] = $new_field_form;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -430,22 +449,14 @@ function materio_showroom_menu_local_tasks_alter(&$data, $router_item, $root_pat
|
||||
*/
|
||||
function materio_showroom_menu() {
|
||||
|
||||
$items['admin/config/content/materio_showroom'] = array(
|
||||
$items['admin/config/content/materio/migrate_showroom'] = array(
|
||||
'title' => 'Showrooms location fields migration settings',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('materio_showroom_migrate_location_fields_settings_form'),
|
||||
'access arguments' => array('materio showroom migrate fields'),
|
||||
'type' => MENU_LOCAL_ACTION,
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
// 'file' => ,
|
||||
);
|
||||
// $items['admin/config/content/materio_showroom/migrate'] = array(
|
||||
// 'title' => 'Migrate showrooms location fields',
|
||||
// 'page callback' => 'materio_showroom_migrate_location_fields',
|
||||
// // 'page arguments' => array('materio_showroom_migrate_location_fields'),
|
||||
// 'access arguments' => array('materio showroom migrate fields'),
|
||||
// 'type' => MENU_LOCAL_TASK,
|
||||
// // 'file' => ,
|
||||
// );
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
@@ -4176,16 +4176,16 @@ article.node-materiau.vm-bookmark, article.node-breve.vm-bookmark {
|
||||
height: 17px; }
|
||||
article.node-materiau.vm-bookmark div.workflow, article.node-breve.vm-bookmark div.workflow {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 11;
|
||||
padding: 5px;
|
||||
border-radius: 5px 0 3px 0;
|
||||
border-radius: 3px 0 5px 0;
|
||||
background-clip: padding-box;
|
||||
font-size: 10px;
|
||||
vertical-align: top;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
color: #000; }
|
||||
background-color: rgba(20, 20, 20, 0.9);
|
||||
color: #fff; }
|
||||
article.node-materiau.vm-bookmark div.workflow span, article.node-breve.vm-bookmark div.workflow span {
|
||||
padding: 3px 0 0 4px;
|
||||
display: moz-inline-stack;
|
||||
@@ -4378,16 +4378,16 @@ article.node-materiau.vm-cardsmall, article.node-breve.vm-cardsmall {
|
||||
height: 17px; }
|
||||
article.node-materiau.vm-cardsmall div.workflow, article.node-breve.vm-cardsmall div.workflow {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 11;
|
||||
padding: 5px;
|
||||
border-radius: 5px 0 3px 0;
|
||||
border-radius: 3px 0 5px 0;
|
||||
background-clip: padding-box;
|
||||
font-size: 10px;
|
||||
vertical-align: top;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
color: #000; }
|
||||
background-color: rgba(20, 20, 20, 0.9);
|
||||
color: #fff; }
|
||||
article.node-materiau.vm-cardsmall div.workflow span, article.node-breve.vm-cardsmall div.workflow span {
|
||||
padding: 3px 0 0 4px;
|
||||
display: moz-inline-stack;
|
||||
@@ -4642,16 +4642,16 @@ article.node-materiau.vm-cardmedium, article.node-breve.vm-cardmedium {
|
||||
height: 17px; }
|
||||
article.node-materiau.vm-cardmedium div.workflow, article.node-breve.vm-cardmedium div.workflow {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 11;
|
||||
padding: 5px;
|
||||
border-radius: 5px 0 3px 0;
|
||||
border-radius: 3px 0 5px 0;
|
||||
background-clip: padding-box;
|
||||
font-size: 10px;
|
||||
vertical-align: top;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
color: #000; }
|
||||
background-color: rgba(20, 20, 20, 0.9);
|
||||
color: #fff; }
|
||||
article.node-materiau.vm-cardmedium div.workflow span, article.node-breve.vm-cardmedium div.workflow span {
|
||||
padding: 3px 0 0 4px;
|
||||
display: moz-inline-stack;
|
||||
@@ -4998,16 +4998,16 @@ article.node-materiau.vm-cardbig, article.node-breve.vm-cardbig {
|
||||
height: 17px; }
|
||||
article.node-materiau.vm-cardbig div.workflow, article.node-breve.vm-cardbig div.workflow {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 11;
|
||||
padding: 5px;
|
||||
border-radius: 5px 0 3px 0;
|
||||
border-radius: 3px 0 5px 0;
|
||||
background-clip: padding-box;
|
||||
font-size: 10px;
|
||||
vertical-align: top;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
color: #000; }
|
||||
background-color: rgba(20, 20, 20, 0.9);
|
||||
color: #fff; }
|
||||
article.node-materiau.vm-cardbig div.workflow span, article.node-breve.vm-cardbig div.workflow span {
|
||||
padding: 3px 0 0 4px;
|
||||
display: moz-inline-stack;
|
||||
@@ -5350,16 +5350,16 @@ article.node-materiau.vm-cardfull, article.node-breve.vm-cardfull {
|
||||
height: 17px; }
|
||||
article.node-materiau.vm-cardfull div.workflow, article.node-breve.vm-cardfull div.workflow {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 11;
|
||||
padding: 5px;
|
||||
border-radius: 5px 0 3px 0;
|
||||
border-radius: 3px 0 5px 0;
|
||||
background-clip: padding-box;
|
||||
font-size: 10px;
|
||||
vertical-align: top;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
color: #000; }
|
||||
background-color: rgba(20, 20, 20, 0.9);
|
||||
color: #fff; }
|
||||
article.node-materiau.vm-cardfull div.workflow span, article.node-breve.vm-cardfull div.workflow span {
|
||||
padding: 3px 0 0 4px;
|
||||
display: moz-inline-stack;
|
||||
@@ -5648,16 +5648,16 @@ article.node-materiau.vm-cardfull, article.node-breve.vm-cardfull {
|
||||
height: 17px; }
|
||||
.print-node-materiau div.workflow {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 11;
|
||||
padding: 5px;
|
||||
border-radius: 5px 0 3px 0;
|
||||
border-radius: 3px 0 5px 0;
|
||||
background-clip: padding-box;
|
||||
font-size: 10px;
|
||||
vertical-align: top;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
color: #000; }
|
||||
background-color: rgba(20, 20, 20, 0.9);
|
||||
color: #fff; }
|
||||
.print-node-materiau div.workflow span {
|
||||
padding: 3px 0 0 4px;
|
||||
display: moz-inline-stack;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// @koala-prepend "gui_ck_fw/gui.js"
|
||||
// @codekit-prepend "gui.js"
|
||||
|
||||
(function($) {
|
||||
|
||||
|
||||
@@ -48,13 +45,13 @@
|
||||
// touch scroll
|
||||
position = {x:null,y:null},
|
||||
translate3d_content = 0,
|
||||
_isLoggedIn = !$('body').is('.not-logged-in'),
|
||||
_isFrontNotLogged = $('body').is('.front.not-logged-in'),
|
||||
_isLoggedIn = !_$body.is('.not-logged-in'),
|
||||
_isFrontNotLogged = _$body.is('.front.not-logged-in'),
|
||||
_isFrontHomeV2 = _$body.is('.home-v2'),
|
||||
_skrollr,
|
||||
_isMembershipForm = $('body').is('.page-node-11186'), //$('body').is('.page-node-11187') || ,
|
||||
// _isBreveMateriauNodePage = $('body').is('.node-type-breve') || $('body').is('.node-type-materiau');
|
||||
_isBreveMateriauNodePage = _themeSettings.page_callback == 'node_page_view' && (_themeSettings.node_type == 'materiau' || _themeSettings.node_type == 'breve'),
|
||||
_isMembershipForm = _$body.is('.page-node-11186'), //$('body').is('.page-node-11187') || ,
|
||||
_isBreveMateriauNodePage = _$body.is('.node-type-breve') || _$body.is('.node-type-materiau'),
|
||||
// _isBreveMateriauNodePage = _themeSettings.page_callback == 'node_page_view' && (_themeSettings.node_type == 'materiau' || _themeSettings.node_type == 'breve'),
|
||||
_resizeTimer,
|
||||
_max_480 = function(){ return (viewport().width < 479); },
|
||||
_480_768 = function(){ return ( !_max_480() && _max_768() ); },
|
||||
@@ -531,7 +528,7 @@
|
||||
};
|
||||
|
||||
function onResultsChanged(event){
|
||||
// trace('MaterioBaseTheme :: onResultsChanged',event);
|
||||
trace('MaterioBaseTheme :: onResultsChanged',event);
|
||||
$(document).scrollTop(0);
|
||||
|
||||
focusCard($('#content .search-results, #content .actuality-items').children('.node:first-child'));
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
@@ -71,8 +71,8 @@ foreach ($heads as $type=>$head)
|
||||
drupal_add_html_head($head, $type);
|
||||
|
||||
|
||||
// this is not working anymore, node object don't shows up on vars
|
||||
$node = isset($vars['node']) ? $vars['node'] : false;
|
||||
|
||||
# add body classes
|
||||
if($node){
|
||||
|
||||
@@ -142,5 +142,3 @@ foreach ($vars['head_title_array'] as $key => $value){
|
||||
}
|
||||
}
|
||||
$vars['head_title'] = $vars['head_array']['title'] = strip_tags(implode(' | ', $head_title_array));
|
||||
|
||||
|
||||
|
||||
@@ -1305,11 +1305,11 @@ $cardfull_h:610px;
|
||||
// &:hover{nav.nav{display:block;}}
|
||||
|
||||
div.workflow{
|
||||
position:absolute; top:0; left:0; z-index:11;
|
||||
position:absolute; bottom:0; right:0; z-index:11;
|
||||
padding: 5px;
|
||||
@include border-radius(5px, 0, 3px, 0);
|
||||
@include border-radius(3px, 0, 5px, 0);
|
||||
@include fs11; vertical-align: top;
|
||||
background-color: rgba(255, 255, 255, 0.9); color:#000;
|
||||
background-color: rgba(20, 20, 20, 0.9); color:#fff;
|
||||
span{padding: 3px 0 0 4px; @include inlineblock();}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user