... and why should they :)

The block_class module provides a ui for adding classes to blocks. However, these settings don't export/import with fe_block. I've attached a patch that checks for the existence of the block_class module and if its there, it adds the classes needed and manages the import/export of them.

This is part of a larger issue that the fe_block_settings really should be using the block module's alter commands for the info, and the block save commands for saving blocks. This way every module that interacts with blocks gets a chance to load/save its settings.

If that's not an option, a hook/alter system for the settings components we are going to export might work instead. In the mean time, the patch supplied should help. Given that I deal with features extra on a daily basis for new clients each week, I certainly have the opportunity to work out a more in depth fix if we want to discuss/hash out how it would work.

hope this helps!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xaqrox’s picture

This is being handled in the block_class module itself: #1230234: features support ?

brad.bulger’s picture

Except that they don't provide useful support for custom blocks. There didn't seem to be much motivation to do otherwise - looks like a pretty standard case of a problem falling between two modules.

Which is a point in favor of what netw3rker was saying about a more general solution, I guess. The patch seems to be working OK still for now.

brad.bulger’s picture

new patch made against the current 1.x-dev code

pfrenssen’s picture

Status: Active » Needs review
pfrenssen’s picture

Status: Needs review » Needs work

I reviewed the patch, it looks good, just two minor remarks:

+++ b/fe_block.moduleundefined
@@ -477,6 +483,9 @@ function fe_block_settings_features_revert($module_name = NULL) {
+    if (isset($block_classes) and module_exists('block_class')) {
+      _fe_block_settings_update_block_classes($block, $block_classes);

Use '&&' instead of 'and'.

+function _fe_block_get_block_classes($block) {
+  $result = ''; ¶
+
+  if (!module_exists('block_class')) return $result;
+

This one line if is against coding standards, use brackets :) This is used twice in the patch.

pfrenssen’s picture

I have created a new branch '1342996' for this issue. I have committed the patch from #3 with remarks from#5 addressed. I also added a bit more documentation and converted the db_query to db_select.

I'd like to add a test for this before merging it in 7.x.

Attached is the diff with current 7.x for people who prefer patches over branches.

pfrenssen’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
3.29 KB
6.94 KB

Added test.

58628c3 Issue #1342996: Use a text format that is supported by the 'testing' profile.
5728232 Issue #1342996: Added a test for the Block Class integration.

Status: Needs review » Needs work

The last submitted patch, 1342996-7-features_extra-block_class-test_only.patch, failed testing.

pfrenssen’s picture

Status: Needs work » Needs review
pfrenssen’s picture

Status: Needs review » Needs work

The last submitted patch, 1342996-7-features_extra-block_class-test_only.patch, failed testing.

pfrenssen’s picture

Hmm the bot fails with the following error:

Fatal error: Call to undefined function fe_block_get_bid() in /var/lib/drupaltestbot/sites/default/files/checkout/sites/default/modules/features_extra/tests/fe_block.test on line 57

This means that the fe_block module is not loaded. I'm speculating that this is caused by the new dependency on block_class that has been introduced in this issue. The test bots only refresh their dependency list when a new dev release is made, so the test bot does not have Block Class installed when the test launches. This probably causes module_enable() to bail out early with FALSE.

Locally the test runs fine:

[pieter@localhost drupal (7.x %=)]$ php ./scripts/run-tests.sh --php /usr/bin/php --color --url http://drupal.dev "Features Extra"

Drupal test run
---------------

Tests to be run:
 - FE Block (FeaturesExtraBlockTestCase)

Test run started:
 Friday, March 1, 2013 - 17:30

Test summary
------------

FE Block 43 passes, 0 fails, 0 exceptions, and 7 debug messages

Test run duration: 28 sec

I'm going to add Block Class as a test_dependency in the dev branch and wait until a new dev release is packaged before relaunching the tests.

pfrenssen’s picture

Status: Needs work » Needs review
pfrenssen’s picture

Status: Needs review » Needs work

The last submitted patch, 1342996-7-features_extra-block_class-test_only.patch, failed testing.

pfrenssen’s picture

Ok there goes my theory lol. I'm going out on a limb and merge this in 7.x-1.x. If problems should arise I will revert these changes.

pfrenssen’s picture

Status: Needs work » Fixed

This is working fine since I added support for Block Class 2.x in #1952922: Add support for Block Class 2.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.