Hi.
Once upon a time I recreated feature and suddenly got
required = 1
in info file. As far as I know, this is the flag which tells system that this module is absolutely required. But where it comes from and why?
ps: I deleted this line and recreated feature and again got this flag.

Comments

mpotter’s picture

Status: Active » Postponed (maintainer needs more info)

Nothing in features adds that "required" as far as I can tell from the source code. Anybody else know where this might come from? Also, be sure to use the 1.0 release and not the rc3 release.

Georgique’s picture

Version: 7.x-1.0-rc3 » 7.x-1.0
Status: Postponed (maintainer needs more info) » Active

@mpotter I'v studied Features source code and yes, I haven't found where this flag is created neither. Today upgraded Features from rc3 to stable version but still have this strange behaviour.

lex0r’s picture

Could this be a PHP version related issue?

milesw’s picture

My feature has a custom field type defined, which I suspect is triggering the required flag. Can't figure out what's adding it, but it's doing a good job of breaking simpletests.

Georgique’s picture

@milesw Mine does also have custom field type. How have you found that this is the reason?

milesw’s picture

I tracked this down to the Field module, in field_system_info_alter(). If a module implements hook_field_info() the Field module will flag it as required.

No idea what the rationale is behind this flag, but it doesn't seem to me that Features should intervene. As a workaround you can implement hook_system_info_alter() and override the flag...

/**
 * Implements hook_system_info_alter().
 */
function myfeature_system_info_alter(&$info, $file, $type) {
  if (isset($info['project']) && $info['project'] == 'myfeature') {
    $info['required'] = FALSE;
  }
}

That implementation needs to run after the Field module, which can be done through module weights or...

/**
 * Implements hook_module_implements_alter().
 */
function myfeature_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'system_info_alter') {
    unset($implementations['myfeature']);
    $implementations['myfeature'] = FALSE;
  }
}
hefox’s picture

Version: 7.x-1.0 » 7.x-2.x-dev
Issue summary: View changes
Status: Active » Fixed

Sounds good, marking this fixed for now as a fixed support request. Upping version as might as well for anyone looking for why.

Status: Fixed » Closed (fixed)

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