You are here

public static function Features::isOverridden in Hook Update Deploy Tools 8

Same name and namespace in other branches
  1. 7 src/Features.php \HookUpdateDeployTools\Features::isOverridden()

Check to see if a feature component is overridden.

Parameters

string $feature_name: The machine name of the feature to check the status of.

string $component_name: The name of the component being checked.

Return value

bool

  • TRUE if overridden.
  • FALSE if not overidden (at default).
1 call to Features::isOverridden()
Features::revert in src/Features.php
Safely revert an array of Features and provide feedback.

File

src/Features.php, line 166

Class

Features
Public method for reverting Features only if needed.

Namespace

HookUpdateDeployTools

Code

public static function isOverridden($feature_name, $component_name) {

  // Get file not included during update.
  module_load_include('inc', 'features', 'features.export');

  // Refresh the Feature list so not cached.
  // Rebuild the list of features includes.
  features_include(TRUE);

  // Need to include any new files.
  features_include_defaults(NULL, TRUE);

  // Check the status of the feature component.
  $states = features_get_component_states(array(
    $feature_name,
  ), FALSE, TRUE);
  self::fixLaggingFieldGroup($states);
  if (empty($states[$module][$component])) {

    // Default, not overidden.
    $status = FEATURES_DEFAULT;
  }
  else {

    // Overridden.
    $status = TRUE;
  }
  return $status;
}