• Context 7.x-3.0-beta2
  • CTools 7.x-1.0-beta1

I've created several contexts that I want to reuse, and exported them as part of a feature. When I build/install a site and enable my feature, all of the the contexts are listed on the feature page, in a default state. But the contexts do not appear on /admin/structure/context/list.

I've run drush site-install --verbose --debug and noticed nothing out of the ordinary.

Comments

hefox’s picture

Status: Active » Postponed (maintainer needs more info)

Is the .features.inc there and is hook_ctools_api in that file?

davidtrainer’s picture

.features.inc has hook_ctools_plugin_api, but not hook_ctools_api:

/**
 * Implements hook_ctools_plugin_api().
 */
function mm_defaults_ctools_plugin_api() {
  list($module, $api) = func_get_args();
  if ($module == "context" && $api == "context") {
    return array("version" => "3");
  }
  list($module, $api) = func_get_args();
  if ($module == "strongarm" && $api == "strongarm") {
    return array("version" => "1");
  }
}
davidtrainer’s picture

Status: Postponed (maintainer needs more info) » Active

Forgot to change status.

hefox’s picture

Ah I was thinking of d6 hook; guess this is the equalent d7 so that looks good

And features.inc is included at top of your .module?

davidtrainer’s picture

Status: Active » Closed (fixed)

No (!) features.inc was not included in the .module. I added it and confirmed that it fixed the issue. Thanks, hefox.

The module contained some custom code and, prior to that, the comment // Drupal needs this blank file. Could this have happened because I added custom code to the module, before adding contexts to the feature?

hefox’s picture

f the feature was created and didn't have that line added, the line isn't automatically added when it's readded. There's at least one issue about fixing that (don't have NID handy)

gauravkumar87’s picture

Version: 7.x-1.0-beta6 » 7.x-1.0-rc1
Status: Closed (fixed) » Active

A related issue persists :

  • Ctools - 7.x-1.0
  • Context - 7.x-3.0-beta2
  • Features - 7.x-1.0-rc1

When I try and export contexts via features, the contexts do not get installed. Upon further investigation, it turned out that the features.inc file in my feature export contained :

function project_moderation_ctools_plugin_api() {
  return array("version" => "1");
}

instead of

function project_moderation_ctools_plugin_api() {
	list($module, $api) = func_get_args();
	if ($module == "context" && $api == "context") {
		return array("version" => "3");
	}
	list($module, $api) = func_get_args();
	if ($module == "strongarm" && $api == "strongarm") {
		return array("version" => "1");
	}
}

Once I replaced this function with the actual contents, the context was installed.

~Gaurav

hefox’s picture

Status: Active » Closed (duplicate)

There's quite a few issues about this, and has been fixed in -dev