Loading features.api.php +8 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,14 @@ * 'base': Optional. An alternative base key to use when calling features * hooks for this component. Can be used for features component types that * are declared "dynamically" or are part of a family of components. * * 'alter_type': What type of alter hook this hook uses. 'normal' is called * after the main hook is called. 'inline' is embeded within the default hook * and may not be implemented by some default hooks. * 'none' is no alter hook exists. Defaults to 'normal' * * 'alter_hook': What the name of the alter hook for this component is. * Do not include the '_alter' part. Defaults to 'default_hook'. */ function hook_features_api() { return array( Loading features.export.inc +15 −2 Original line number Diff line number Diff line Loading @@ -354,6 +354,16 @@ function features_get_default_hooks($component = NULL, $reset = FALSE) { return features_get_components($component, 'default_hook', $reset); } /** * Gets the available default hooks keyed by components. */ function features_get_default_alter_hook($component) { $default_hook = features_get_components($component, 'default_hook'); $alter_hook = features_get_components($component, 'alter_hook'); $alter_type = features_get_components($component, 'alter_type'); return empty($alter_type) || $alter_type != 'none' ? ($alter_hook ? $alter_hook : $default_hook) : FALSE; } /** * Return a code string representing an implementation of a defaults module hook. */ Loading Loading @@ -655,8 +665,11 @@ function features_get_default($component, $module_name = NULL, $alter = TRUE, $r else { if ($default_hook && module_hook($m, $default_hook)) { $cache[$component][$m] = call_user_func("{$m}_{$default_hook}"); if ($alter) { drupal_alter($default_hook, $cache[$component][$m]); $alter_type = features_get_components('alter_type', $component); if ($alter && (!isset($alter_type) || $alter_type == FEATURES_ALTER_TYPE_NORMAL)) { if ($alter_hook = features_get_default_alter_hook($component)) { drupal_alter($alter_hook, $cache[$component][$m]); } } } else { Loading features.module +3 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ define('FEATURES_NEEDS_REVIEW', 2); define('FEATURES_REBUILDING', 3); define('FEATURES_CONFLICT', 4); define('FEATURES_DISABLED', 5); define('FEATURES_ALTER_TYPE_NORMAL', 'normal'); define('FEATURES_ALTER_TYPE_INLINE', 'inline'); define('FEATURES_ALTER_TYPE_NONE', 'none'); // Duration of rebuild semaphore: 10 minutes. define('FEATURES_SEMAPHORE_TIMEOUT', 10 * 60); Loading includes/features.image.inc +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ function image_features_api() { 'name' => t('Image styles'), 'feature_source' => TRUE, 'default_hook' => 'image_default_styles', 'alter_hook' => 'image_styles', ) ); } Loading Loading
features.api.php +8 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,14 @@ * 'base': Optional. An alternative base key to use when calling features * hooks for this component. Can be used for features component types that * are declared "dynamically" or are part of a family of components. * * 'alter_type': What type of alter hook this hook uses. 'normal' is called * after the main hook is called. 'inline' is embeded within the default hook * and may not be implemented by some default hooks. * 'none' is no alter hook exists. Defaults to 'normal' * * 'alter_hook': What the name of the alter hook for this component is. * Do not include the '_alter' part. Defaults to 'default_hook'. */ function hook_features_api() { return array( Loading
features.export.inc +15 −2 Original line number Diff line number Diff line Loading @@ -354,6 +354,16 @@ function features_get_default_hooks($component = NULL, $reset = FALSE) { return features_get_components($component, 'default_hook', $reset); } /** * Gets the available default hooks keyed by components. */ function features_get_default_alter_hook($component) { $default_hook = features_get_components($component, 'default_hook'); $alter_hook = features_get_components($component, 'alter_hook'); $alter_type = features_get_components($component, 'alter_type'); return empty($alter_type) || $alter_type != 'none' ? ($alter_hook ? $alter_hook : $default_hook) : FALSE; } /** * Return a code string representing an implementation of a defaults module hook. */ Loading Loading @@ -655,8 +665,11 @@ function features_get_default($component, $module_name = NULL, $alter = TRUE, $r else { if ($default_hook && module_hook($m, $default_hook)) { $cache[$component][$m] = call_user_func("{$m}_{$default_hook}"); if ($alter) { drupal_alter($default_hook, $cache[$component][$m]); $alter_type = features_get_components('alter_type', $component); if ($alter && (!isset($alter_type) || $alter_type == FEATURES_ALTER_TYPE_NORMAL)) { if ($alter_hook = features_get_default_alter_hook($component)) { drupal_alter($alter_hook, $cache[$component][$m]); } } } else { Loading
features.module +3 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ define('FEATURES_NEEDS_REVIEW', 2); define('FEATURES_REBUILDING', 3); define('FEATURES_CONFLICT', 4); define('FEATURES_DISABLED', 5); define('FEATURES_ALTER_TYPE_NORMAL', 'normal'); define('FEATURES_ALTER_TYPE_INLINE', 'inline'); define('FEATURES_ALTER_TYPE_NONE', 'none'); // Duration of rebuild semaphore: 10 minutes. define('FEATURES_SEMAPHORE_TIMEOUT', 10 * 60); Loading
includes/features.image.inc +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ function image_features_api() { 'name' => t('Image styles'), 'feature_source' => TRUE, 'default_hook' => 'image_default_styles', 'alter_hook' => 'image_styles', ) ); } Loading