diff --git a/fieldblock.module b/fieldblock.module index 315e98881d11adc37e0c63aa2bbd8e387465ea28..7835d98155bd8bc65fbfba65620de131a22f4d39 100644 --- a/fieldblock.module +++ b/fieldblock.module @@ -18,7 +18,7 @@ function fieldblock_form_field_ui_display_overview_form_alter(&$form, &$form_sta $view_mode = $form['#view_mode']; $variable_name = 'fieldblock-'. $entity_type .'-'. $bundle .'-'. $view_mode; - $settings = variable_get($variable_name); + $settings = variable_get($variable_name, array()); // Add a column header. $form['fields']['#header'][] = t('Display as block'); @@ -112,19 +112,17 @@ function fieldblock_get_block_list() { } // Get the settings from the stored variable. $variable_name = 'fieldblock-'. $entity_type .'-'. $bundle .'-'. $view_mode; - $fieldblock_settings = variable_get($variable_name, false); - // If it exists, loop over the fields defined in the variable. - if ($fieldblock_settings) { - foreach ($fieldblock_settings as $field_name => $field_label) { - // Build the fieldblock info. - $fieldblock_id = $variable_name .'-'. $field_name; - $fieldblocks[$fieldblock_id] = t('@field field (from @type: @bundle: @view_mode)', array( - '@field' => $instances[$entity_type][$bundle][$field_name]['label'], - '@type' => $entity_type, - '@bundle' => $bundle_info['label'], - '@view_mode' => $view_mode, - )); - } + $fieldblock_settings = variable_get($variable_name, array()); + // Loop over the fields defined in the variable. + foreach ($fieldblock_settings as $field_name => $field_label) { + // Build the fieldblock info. + $fieldblock_id = $variable_name .'-'. $field_name; + $fieldblocks[$fieldblock_id] = t('@field field (from @type: @bundle: @view_mode)', array( + '@field' => $instances[$entity_type][$bundle][$field_name]['label'], + '@type' => $entity_type, + '@bundle' => $bundle_info['label'], + '@view_mode' => $view_mode, + )); } } } @@ -175,7 +173,7 @@ function fieldblock_field_attach_view_alter(&$output, $context) { $fieldblocks_storage = &drupal_static(FIELDBLOCK_STORAGE_STATIC); $variable_name = 'fieldblock-'. $entity_type .'-'. $bundle .'-'. $actual_mode; - $fieldblock_settings = variable_get($variable_name, false); + $fieldblock_settings = variable_get($variable_name, array()); // Loop over the fieldblocks for this entity + bundle + view mode combination // and store the field's render array for later use.