本文整理汇总了PHP中menu_rebuild函数的典型用法代码示例。如果您正苦于以下问题:PHP menu_rebuild函数的具体用法?PHP menu_rebuild怎么用?PHP menu_rebuild使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了menu_rebuild函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: iShouldSeeAValidCatalogXml
/**
* @Then I should see a valid catalog xml
*/
public function iShouldSeeAValidCatalogXml()
{
// Change /catalog.xml path to /catalog during tests. The '.' on the filename breaks tests on CircleCI's server.
$dcat = open_data_schema_map_api_load('dcat_v1_1');
if ($dcat->endpoint !== 'catalog') {
$dcat->endpoint = 'catalog';
drupal_write_record('open_data_schema_map', $dcat, 'id');
drupal_static_reset('open_data_schema_map_api_load_all');
menu_rebuild();
}
// Change /catalog.json path to /catalogjson during tests. The '.' on the filename breaks tests on CircleCI's server.
$dcat_json = open_data_schema_map_api_load('dcat_v1_1_json');
if ($dcat_json->endpoint !== 'catalogjson') {
$dcat_json->endpoint = 'catalogjson';
drupal_write_record('open_data_schema_map', $dcat_json, 'id');
drupal_static_reset('open_data_schema_map_api_load_all');
menu_rebuild();
}
// Get base URL.
$url = $this->getMinkParameter('base_url') ? $this->getMinkParameter('base_url') : "http://127.0.0.1::8888";
$url_xml = $url . '/catalog';
$url_json = $url . '/catalogjson';
$this->visitPath($url_xml);
$this->assertSession()->statusCodeEquals('200');
// Validate DCAT.
$results = open_data_schema_dcat_process_validate($url_json, TRUE);
if ($results['errors']) {
throw new \Exception(sprintf('catalog.xml is not valid.'));
}
}
示例2: edit_save_form
/**
* Overrides ctools_export_ui::edit_save_form().
*
* Clear menu cache in case the SPARQL endpoint path was modified.
*/
function edit_save_form($form_state)
{
parent::edit_save_form($form_state);
if (!empty($form_state['plugin']['schema']) && $form_state['plugin']['schema'] == 'arc2_store_settings') {
menu_rebuild();
}
}
示例3: match
/**
* {@inheritDocs}
*/
public function match($pathinfo)
{
// The 'q' variable is pervasive in Drupal, so it's best to just keep
// it even though it's very un-Symfony.
$path = drupal_get_normal_path(substr($pathinfo, 1));
if (variable_get('menu_rebuild_needed', FALSE) || !variable_get('menu_masks', array())) {
menu_rebuild();
}
$original_map = arg(NULL, $path);
$parts = array_slice($original_map, 0, MENU_MAX_PARTS);
$ancestors = menu_get_ancestors($parts);
$router_item = db_query_range('SELECT * FROM {menu_router} WHERE path IN (:ancestors) ORDER BY fit DESC', 0, 1, array(':ancestors' => $ancestors))->fetchAssoc();
if ($router_item) {
// Allow modules to alter the router item before it is translated and
// checked for access.
drupal_alter('menu_get_item', $router_item, $path, $original_map);
// The requested path is an unalaised Drupal route.
return array('_drupal' => true, '_controller' => function ($_router_item) {
$router_item = $_router_item;
if (!$router_item['access']) {
throw new AccessDeniedException();
}
if ($router_item['include_file']) {
require_once DRUPAL_ROOT . '/' . $router_item['include_file'];
}
return call_user_func_array($router_item['page_callback'], $router_item['page_arguments']);
}, '_route' => $router_item['path']);
}
throw new ResourceNotFoundException();
}
示例4: testNewAndRemoveSearchPage
/**
* Asserts that we create a new search page and remove it again
*/
function testNewAndRemoveSearchPage()
{
// Create a new search page
$this->drupalLogin($this->admin_user);
$this->drupalGet('admin/config/search/apachesolr/search-pages');
$this->assertText(t('Add search page'), t('Create new search page link is available'));
$this->clickLink(t('Add search page'));
$this->assertText(t('The human-readable name of the search page configuration.'), t('Search page creation page succesfully added'));
$edit = array('page_id' => 'solr_testingsuite', 'env_id' => 'solr', 'label' => 'Test Search Page', 'description' => 'Test Description', 'page_title' => 'Test Title', 'search_path' => 'search/searchdifferentpath');
$this->drupalPost($this->getUrl(), $edit, t('Save configuration'));
$this->assertResponse(200);
// Make sure the menu is recognized
drupal_static_reset('apachesolr_search_page_load');
menu_cache_clear_all();
menu_rebuild();
$this->drupalGet('admin/config/search/apachesolr/search-pages');
$this->assertText(t('Test Search Page'), t('Search Page was succesfully created'));
// Remove the same environment
$this->clickLink(t('Delete'));
$this->assertText(t('search page configuration will be deleted.This action cannot be undone.'), t('Delete confirmation page was succesfully loaded'));
$this->drupalPost($this->getUrl(), array(), t('Delete page'));
$this->assertResponse(200);
drupal_static_reset('apachesolr_search_page_load');
$this->drupalGet('admin/config/search/apachesolr/search-pages');
$this->assertNoText(t('Test Search Page'), t('Search Environment was succesfully deleted'));
}
示例5: xautoloadTestWithCacheTypes
/**
* @param array $cache_types
* The autoloader modes that are enabled, e.g.
* array('apc' => 'apc', 'xcache' => 'xcache')
* @param bool $cache_lazy
* Whether the "lazy" mode is enabled.
*/
protected function xautoloadTestWithCacheTypes($cache_types, $cache_lazy)
{
// @FIXME
// // @FIXME
// // The correct configuration object could not be determined. You'll need to
// // rewrite this call manually.
// variable_set(XAUTOLOAD_VARNAME_CACHE_TYPES, $cache_types);
$this->pass("Set cache types: " . var_export($cache_types, TRUE));
// @FIXME
// // @FIXME
// // The correct configuration object could not be determined. You'll need to
// // rewrite this call manually.
// variable_set(XAUTOLOAD_VARNAME_CACHE_LAZY, $cache_lazy);
$this->pass("Set cache lazy mode: " . var_export($cache_lazy, TRUE));
// Enable xautoload.
module_enable(array('xautoload'), FALSE);
// At this time the xautoload_cache_mode setting is not in effect yet,
// so we have to clear old cached values from APC cache.
xautoload()->cacheManager->renewCachePrefix();
module_enable(array('xautoload_test_1', 'xautoload_test_2', 'xautoload_test_3', 'xautoload_test_4', 'xautoload_test_5'), FALSE);
menu_rebuild();
foreach (array('xautoload_test_1' => array('Drupal\\xautoload_test_1\\ExampleClass'), 'xautoload_test_2' => array('xautoload_test_2_ExampleClass'), 'xautoload_test_3' => array('Drupal\\xautoload_test_3\\ExampleClass')) as $module => $classes) {
$classes_on_include = in_array($module, array('xautoload_test_2', 'xautoload_test_3'));
$this->xautoloadModuleEnabled($module, $classes, $classes_on_include);
$this->xautoloadModuleCheckJson($module, $cache_types, $cache_lazy, $classes);
}
}
示例6: edit_save_form
/**
* Ensure menu gets rebuild after saving a new type.
*/
function edit_save_form($form_state)
{
parent::edit_save_form($form_state);
entity_info_cache_clear();
menu_rebuild();
if ($form_state['op'] === 'save_continue') {
$this->plugin['redirect']['save_continue'] = $this->field_admin_path($form_state['values']['name'], 'fields');
}
}
示例7: hook_commerce_coupon_type_delete
/**
* This hook called when a coupon type deleted.
*
* @param string $type Coupon type.
*/
function hook_commerce_coupon_type_delete($type)
{
// Delete all coupons of this type.
if ($pids = array_keys(commerce_coupon_load_multiple(FALSE, array('type' => $type->type)))) {
commerce_coupon_delete_multiple($pids);
}
// Rebuild the menu as any (user-category) menu items should be gone now.
menu_rebuild();
}
示例8: setUpBeforeClass
public static function setUpBeforeClass()
{
// Change /data.json path to /json during tests.
$data_json = open_data_schema_map_api_load('data_json_1_1');
$data_json->endpoint = 'json';
drupal_write_record('open_data_schema_map', $data_json, 'id');
drupal_static_reset('open_data_schema_map_api_load_all');
menu_rebuild();
}
示例9: set_item_state
function set_item_state($state, $js, $input, $item)
{
ctools_export_set_object_status($item, $state);
menu_rebuild();
if (!$js) {
drupal_goto(ctools_export_ui_plugin_base_path($this->plugin));
} else {
return $this->list_page($js, $input);
}
}
示例10: _update
/**
* (non-PHPdoc)
* @see Yamm_Entity::_update()
*/
protected function _update($object, $identifier)
{
// TODO we should check for all dependencies which are not data, such as
// handlers and modules (this is done by views_export module).
views_include('view');
// Should give us the '$view' variable
eval($object);
$view->save();
views_ui_cache_set($view);
menu_rebuild();
cache_clear_all('*', 'cache_views');
cache_clear_all();
}
示例11: register
/**
* Registers services on the given app.
*
* This method should only be used to configure services and parameters.
* It should not get services.
*
* @param Application $app An Application instance
*/
public function register(Application $app)
{
$app['drupal.bootstrap.class'] = 'Bangpound\\Bridge\\Drupal\\Bootstrap';
$app['drupal.class'] = 'Druplex';
$app['legacy.request_matcher'] = $app->share($app->extend('legacy.request_matcher', function (RequestMatcher $matcher, $c) {
$matcher->matchAttribute('_legacy', 'drupal');
return $matcher;
}));
$app['drupal.listener.header'] = $app->share(function ($c) {
return new HeaderListener($c['legacy.request_matcher']);
});
$app['drupal.bootstrap'] = $app->share(function () use($app) {
/** @var Bootstrap $bootstrap */
$bootstrap = new $app['drupal.bootstrap.class']();
$bootstrap->setEventDispatcher($app['dispatcher']);
require_once $app['web_dir'] . '/includes/bootstrap.inc';
drupal_bootstrap(NULL, TRUE, $bootstrap);
return $bootstrap;
});
$app->before(function (Request $request) use($app) {
$app['drupal.bootstrap'];
define('DRUPAL_ROOT', getcwd());
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$pathinfo = $request->getPathInfo();
// The 'q' variable is pervasive in Drupal, so it's best to just keep
// it even though it's very un-Symfony.
$path = drupal_get_normal_path(substr($pathinfo, 1));
if (variable_get('menu_rebuild_needed', FALSE) || !variable_get('menu_masks', array())) {
menu_rebuild();
}
$original_map = arg(NULL, $path);
$parts = array_slice($original_map, 0, MENU_MAX_PARTS);
$ancestors = menu_get_ancestors($parts);
$router_item = db_query_range('SELECT * FROM {menu_router} WHERE path IN (:ancestors) ORDER BY fit DESC', 0, 1, array(':ancestors' => $ancestors))->fetchAssoc();
if ($router_item) {
// Allow modules to alter the router item before it is translated and
// checked for access.
drupal_alter('menu_get_item', $router_item, $path, $original_map);
// The requested path is an unalaised Drupal route.
$request->attributes->add(array('_route' => $router_item['path'], '_legacy' => 'drupal'));
}
}, 33);
}
示例12: xautoloadTestWithCacheTypes
/**
* @param array $cache_types
* The autoloader modes that are enabled, e.g.
* array('apc' => 'apc', 'xcache' => 'xcache')
* @param bool $cache_lazy
* Whether the "lazy" mode is enabled.
*/
protected function xautoloadTestWithCacheTypes($cache_types, $cache_lazy)
{
variable_set('xautoload_cache_types', $cache_types);
$this->pass("Set cache types: " . var_export($cache_types, TRUE));
variable_set('xautoload_cache_lazy', $cache_lazy);
$this->pass("Set cache lazy mode: " . var_export($cache_lazy, TRUE));
// Enable xautoload.
module_enable(array('xautoload'), FALSE);
// At this time the xautoload_cache_mode setting is not in effect yet,
// so we have to clear old cached values from APC cache.
xautoload()->cacheManager->renewCachePrefix();
module_enable(array('xautoload_test_1', 'xautoload_test_2', 'xautoload_test_3'), FALSE);
menu_rebuild();
foreach (array('xautoload_test_1' => array('Drupal\\xautoload_test_1\\ExampleClass'), 'xautoload_test_2' => array('xautoload_test_2_ExampleClass'), 'xautoload_test_3' => array('Drupal\\xautoload_test_3\\ExampleClass')) as $module => $classes) {
$classes_on_include = in_array($module, array('xautoload_test_2', 'xautoload_test_3'));
$this->xautoloadModuleEnabled($module, $classes, $classes_on_include);
$this->xautoloadModuleCheckJson($module, $cache_types, $cache_lazy, $classes);
}
}
示例13: setUp
/**
* Installs Atrium instead of Drupal
*
* Generates a random database prefix, runs the install scripts on the
* prefixed database and enable the specified modules. After installation
* many caches are flushed and the internal browser is setup so that the
* page requests will run on the new prefix. A temporary files directory
* is created with the same name as the database prefix.
*
* @param ...
* List of modules to enable for the duration of the test.
*/
protected function setUp()
{
global $db_prefix, $user, $language, $profile, $install_locale;
// $language (Drupal 6).
// Store necessary current values before switching to prefixed database.
$this->originalPrefix = $db_prefix;
$this->originalLanguage = clone $language;
$clean_url_original = variable_get('clean_url', 0);
// Must reset locale here, since schema calls t(). (Drupal 6)
if (module_exists('locale')) {
$language = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => '');
locale(NULL, NULL, TRUE);
}
// Generate temporary prefixed database to ensure that tests have a clean starting point.
// $db_prefix = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}');
$db_prefix = 'simpletest' . mt_rand(1000, 1000000);
$install_locale = $this->install_locale;
$profile = $this->install_profile;
// include_once DRUPAL_ROOT . '/includes/install.inc';
include_once './includes/install.inc';
drupal_install_system();
// $this->preloadRegistry();
// Set up theme system for the maintenance page.
// Otherwise we have trouble: https://ds.openatrium.com/dsi/node/18426#comment-38118
// @todo simpletest module patch
drupal_maintenance_theme();
// Add the specified modules to the list of modules in the default profile.
$args = func_get_args();
// $modules = array_unique(array_merge(drupal_get_profile_modules('default', 'en'), $args));
$modules = array_unique(array_merge(drupal_verify_profile($this->install_profile, $this->install_locale), $args));
// drupal_install_modules($modules, TRUE);
drupal_install_modules($modules);
// Because the schema is static cached, we need to flush
// it between each run. If we don't, then it will contain
// stale data for the previous run's database prefix and all
// calls to it will fail.
drupal_get_schema(NULL, TRUE);
if ($this->install_profile == 'openatrium') {
// Download and import translation if needed
if ($this->install_locale != 'en') {
$this->installLanguage($this->install_locale);
}
// Install more modules
$modules = _openatrium_atrium_modules();
drupal_install_modules($modules);
// Configure intranet
// $profile_tasks = $this->install_profile . '_profile_tasks';
_openatrium_intranet_configure();
_openatrium_intranet_configure_check();
variable_set('atrium_install', 1);
// Clear views cache before rebuilding menu tree. Requires patch
// [patch_here] to Views, as new modules have been included and
// default views need to be re-detected.
module_exists('views') ? views_get_all_views(TRUE) : TRUE;
menu_rebuild();
}
_drupal_flush_css_js();
$this->refreshVariables();
$this->checkPermissions(array(), TRUE);
user_access(NULL, NULL, TRUE);
// Drupal 6.
// Log in with a clean $user.
$this->originalUser = $user;
// drupal_save_session(FALSE);
// $user = user_load(1);
session_save_session(FALSE);
$user = user_load(array('uid' => 1));
// Restore necessary variables.
variable_set('install_profile', $this->install_profile);
variable_set('install_task', 'profile-finished');
variable_set('clean_url', $clean_url_original);
variable_set('site_mail', 'simpletest@example.com');
// Use temporary files directory with the same prefix as database.
$this->originalFileDirectory = file_directory_path();
variable_set('file_directory_path', file_directory_path() . '/' . $db_prefix);
$directory = file_directory_path();
// Create the files directory.
file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
set_time_limit($this->timeLimit);
}
示例14: covidien_contenttype_update
function covidien_contenttype_update($arg) {
module_load_include('inc', 'content', 'includes/content.crud');
$module_name = $arg['module_name'];
$import_new = $arg['import_new'];
$import_updatearr = $arg['import_updatearr'];
$import_deletearr = $arg['import_deletearr'];
$import_ctdeletearr = $arg['import_ctdeletearr'];
$import_update = array_keys($import_updatearr);
$files = file_scan_directory(drupal_get_path('module', $module_name) . '/content_type', '.cck_import.inc');
if (is_array($import_ctdeletearr) && count($import_ctdeletearr) > 0) {
foreach ($import_ctdeletearr as $key => $fields) {
if (count($fields) > 0) {
foreach ($fields as $field_name) {
$field = array();
$field['field_name'] = $field_name;
$field['type_name'] = $key;
content_field_instance_delete($field['field_name'], $field['type_name'], FALSE);
drupal_set_message('Deleted ' . $field['field_name'] . ' in ' . $field['type_name']);
}
}
}
// Clear caches and rebuild menu.
content_clear_type_cache(TRUE);
menu_rebuild();
}
foreach ($files as $absolute => $file) {
// Creating new content type.
if (in_array($file->name, $import_new)) {
$form_state = array();
$form_state['values']['type_name'] = '<create>';
$fh = fopen($file->filename, 'r');
$theData = fread($fh, filesize($file->filename));
fclose($fh);
$form_state['values']['macro'] = "$theData";
drupal_execute('content_copy_import_form', $form_state);
}
// Updating existing content type.
if (in_array($file->name, $import_update)) {
// Add the new fileds to the content type
$form_state = array();
$form_state['values']['type_name'] = $import_updatearr[$file->name];
$fh = fopen($file->filename, 'r');
$theData = fread($fh, filesize($file->filename));
eval($theData);
fclose($fh);
$form_state['values']['macro'] = "$theData";
drupal_execute('content_copy_import_form', $form_state);
// Update Title filed label
$title_label = $content['type']['title_label'];
$type = $content['type']['type'];
db_query("UPDATE {node_type} SET title_label = '%s' WHERE type = '%s'", $title_label, $type);
// Update several fields at a time.
if (count($content['fields']) > 0) {
foreach ($content['fields'] as $key => $field) {
if (is_array($field)) {
$field['type_name'] = $content['type']['type'];
if ($field['type_name'] != '' && $field['field_name'] != '') {
content_field_instance_update($field, FALSE);
drupal_set_message('updated ' . $field['field_name'] . ' in ' . $field['type_name']);
}
}
}
}
/**
* Code to remove the cck filed from content type.
*/
if (is_array($import_deletearr)) {
$fields = $import_deletearr[$file->name];
}
if (count($fields) > 0) {
foreach ($fields as $field_name) {
$field = array();
$field['field_name'] = $field_name;
$field['type_name'] = $import_updatearr[$file->name];
content_field_instance_delete($field['field_name'], $field['type_name'], FALSE);
drupal_set_message('Deleted ' . $field['field_name'] . ' in ' . $field['type_name']);
}
}
// Clear caches and rebuild menu.
content_clear_type_cache(TRUE);
menu_rebuild();
}
}
}
示例15: createUFJoin
/**
* Make uf join entries for an uf group.
*
* @param array $params
* (reference) an assoc array of name/value pairs.
* @param int $ufGroupId
* Ufgroup id.
*/
public static function createUFJoin(&$params, $ufGroupId)
{
$groupTypes = CRM_Utils_Array::value('uf_group_type', $params);
// get ufjoin records for uf group
$ufGroupRecord = CRM_Core_BAO_UFGroup::getUFJoinRecord($ufGroupId);
// get the list of all ufgroup types
$allUFGroupType = CRM_Core_SelectValues::ufGroupTypes();
// this fix is done to prevent warning generated by array_key_exits incase of empty array is given as input
if (!is_array($groupTypes)) {
$groupTypes = array();
}
// this fix is done to prevent warning generated by array_key_exits incase of empty array is given as input
if (!is_array($ufGroupRecord)) {
$ufGroupRecord = array();
}
// check which values has to be inserted/deleted for contact
$menuRebuild = FALSE;
foreach ($allUFGroupType as $key => $value) {
$joinParams = array();
$joinParams['uf_group_id'] = $ufGroupId;
$joinParams['module'] = $key;
if ($key == 'User Account') {
$menuRebuild = TRUE;
}
if (array_key_exists($key, $groupTypes) && !in_array($key, $ufGroupRecord)) {
// insert a new record
CRM_Core_BAO_UFGroup::addUFJoin($joinParams);
} elseif (!array_key_exists($key, $groupTypes) && in_array($key, $ufGroupRecord)) {
// delete a record for existing ufgroup
CRM_Core_BAO_UFGroup::delUFJoin($joinParams);
}
}
//update the weight
$query = "\nUPDATE civicrm_uf_join\nSET weight = %1\nWHERE uf_group_id = %2\nAND ( entity_id IS NULL OR entity_id <= 0 )\n";
$p = array(1 => array($params['weight'], 'Integer'), 2 => array($ufGroupId, 'Integer'));
CRM_Core_DAO::executeQuery($query, $p);
// do a menu rebuild if we are on drupal, so it gets all the new menu entries
// for user account
$config = CRM_Core_Config::singleton();
if ($menuRebuild && $config->userSystem->is_drupal) {
menu_rebuild();
}
}