September, 2014

Use a bracket in CSS

To control multiple class names in css. input[readonly=’readonly’] { display:none; }; .views-field[class*=’views-field-view’] { display:block; }input[readonly=’readonly’] { display:none; }; .views-field[class*=’views-field-view’] { display:block; }

Posted in CSS | Comments Off on Use a bracket in CSS

Unlimited cardinality pre-populate fields

I am trying to solve this and my only issue is that I want to keep this field as unlimited cardinality with fields in Field Collection already displayed to the user when they create the other reference node. function module_form_alter(&$form, &$form_state, $form_id) { if($form_id == ‘form_name’) { $reference_query = new EntityFieldQuery(); $reference_query->entityCondition(’entity_type’, ‘node’) ->entityCondition(’bundle’, ‘reference’) ->propertyOrderBy(’created’, ‘DESC’) ->range(0, 1); $reference_result = $reference_query->execute(); $reference_nid = array_keys($reference_result[’node’]); $reference_refer = node_load($reference_nid);   $items_count = count($reference_refer->field_field_name[’und’]); $field_name = ‘field_field_name’; $form_theme = $form[$field_name][’und’][’#theme’]; // Remove delete and add more buttons $form[$field_name][’und’][0][’remove_button’][’#access’] = FALSE; $form[$field_name][’und’][’add_more’][’#access’] = FALSE; $items = &$form_state[’field’][$field_name][’und’];   if ($items_count > 1 and $items[’items_count’] != $items_count) { $items[’items_count’] = $items_count; $items[’field’][’cardinality’] = $items_count; […]


Posted in Drupal | Comments Off on Unlimited cardinality pre-populate fields