Почему некоторые функции переопределяются после установки
Это мой hook_install:
function moocollar_web_install() {
// enable features
$global_features = array ('display_modes_feature' , 'field_bases_feature' , 'image_styles_feature' , 'roles_permissions_feature' , 'sitewide_feature' , 'wysiwyg_feature' , 'menus_feature');
$functionality_features = array ('blog_feature');
$enable_dependencies = TRUE;
module_enable($global_features, $enable_dependencies);
module_enable($functionality_features, $enable_dependencies);
// create editor user
$role = user_role_load_by_name ('editor');
$new_user = new stdClass();
$new_user->name = 'editor';
$new_user->pass = user_password(8); // random password.
$new_user->mail = '[email protected]';
if ($role) {
$new_user->roles = array ($role->rid => $role->name);
}
$new_user->status = 1;
$new_user->is_new = TRUE;
user_save($new_user);
variable_set('features_default_export_path', 'profiles/moocollar_web/modules/features');
}
После установки функция blog_feature переопределяется:
drush features-diff blog_feature
Legend:
Code: drush features-revert will remove the overrides.
Overrides: drush features-update will update the exported feature with the displayed overrides
Component type: info
features[field_instance][] = node-blog_post-body
features[field_instance][] = node-blog_post-field_image
< features[menu_links][] = menu-editor-menu_aadir-post:node/add/blog-post
features[node][] = blog_post
features[user_permission][] = create blog_post content
Component type: menu_links
< array(
< 'menu-editor-menu_aadir-post:node/add/blog-post' => array(
< 'customized' => 1,
< 'link_path' => 'node/add/blog-post',
< 'link_title' => 'Añadir post',
< 'menu_name' => 'menu-editor-menu',
< 'module' => 'menu',
< 'options' => array(
< 'identifier' => 'menu-editor-menu_aadir-post:node/add/blog-post',
< ),
< 'router_path' => 'node/add/blog-post',
< ),
< )
---
> array()
Но если я выполняю функции возврата через drush, функции находятся в состоянии по умолчанию:
drush features-revert blog_feature
Do you really want to revert blog_feature.menu_links? (y/n): y
Reverted blog_feature.menu_links. [ok]
vagrant@precise32 (linkinicio *) httpdocs$ drush fd blog_feature
Feature is in its default state. No diff needed.
На blog_feature.info У меня есть зависимость и элемент:
...
dependencies[] = menu
dependencies[] = menus_feature
....
features[menu_links][] = menu-editor-menu_aadir-post:node/add/blog-post
....
Спасибо вам всем за ваше время.
1 answers
Обычно функции автоматически обнаруживают экспортируемые ctools и добавляют модули, содержащие эти экспортируемые, в список зависимостей, если только не было обнаружено требование к модулю для экспортируемого или зависимые модули не были установлены с момента включения функции.
Основываясь на вашем имени машины ссылки на меню (menu-editor-...
), кажется, что он полагается на модуль Редактора меню , и у вас отсутствует зависимость от этого модуля, поэтому модуль функций не обнаружил этот компонент в качестве требования, таким образом, он становится переопределенным и необратимым.
Решение состоит в том, чтобы добавить отсутствующий модуль в список dependencies
. Затем либо отключите модуль функций и снова включите его, либо вручную включите все не включенные зависимости (см. раздел "Различия функций", чтобы предоставить их).
См.: Устранение неполадок: Причины, по которым функции могут быть заблокированы как переопределенные в Drupal.org