当前位置: 首页>>代码示例>>PHP>>正文


PHP ModuleHandlerInterface::loadInclude方法代码示例

本文整理汇总了PHP中Drupal\Core\Extension\ModuleHandlerInterface::loadInclude方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleHandlerInterface::loadInclude方法的具体用法?PHP ModuleHandlerInterface::loadInclude怎么用?PHP ModuleHandlerInterface::loadInclude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Extension\ModuleHandlerInterface的用法示例。


在下文中一共展示了ModuleHandlerInterface::loadInclude方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processItem

 /**
  * {@inheritdoc}
  *
  * The translation update functions executed here are batch operations which
  * are also used in translation update batches. The batch functions may need
  * to be executed multiple times to complete their task, typically this is the
  * translation import function. When a batch function is not finished, a new
  * queue task is created and added to the end of the queue. The batch context
  * data is needed to continue the batch task is stored in the queue with the
  * queue data.
  */
 public function processItem($data)
 {
     $this->moduleHandler->loadInclude('locale', 'batch.inc');
     list($function, $args) = $data;
     // We execute batch operation functions here to check, download and import
     // the translation files. Batch functions use a context variable as last
     // argument which is passed by reference. When a batch operation is called
     // for the first time a default batch context is created. When called
     // iterative (usually the batch import function) the batch context is passed
     // through via the queue and is part of the $data.
     $last = count($args) - 1;
     if (!is_array($args[$last]) || !isset($args[$last]['finished'])) {
         $batch_context = ['sandbox' => [], 'results' => [], 'finished' => 1, 'message' => ''];
     } else {
         $batch_context = $args[$last];
         unset($args[$last]);
     }
     $args = array_merge($args, [&$batch_context]);
     // Call the batch operation function.
     call_user_func_array($function, $args);
     // If the batch operation is not finished we create a new queue task to
     // continue the task. This is typically the translation import task.
     if ($batch_context['finished'] < 1) {
         unset($batch_context['strings']);
         $this->queue->createItem([$function, $args]);
     }
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:38,代码来源:LocaleTranslation.php

示例2: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     // Make sure the install API is available.
     include_once DRUPAL_ROOT . '/core/includes/install.inc';
     // Get a list of all available modules.
     $modules = system_rebuild_module_data();
     $uninstallable = array_filter($modules, function ($module) use($modules) {
         return empty($modules[$module->getName()]->info['required']) && $module->status;
     });
     // Include system.admin.inc so we can use the sort callbacks.
     $this->moduleHandler->loadInclude('system', 'inc', 'system.admin');
     $form['filters'] = array('#type' => 'container', '#attributes' => array('class' => array('table-filter', 'js-show')));
     $form['filters']['text'] = array('#type' => 'search', '#title' => $this->t('Search'), '#size' => 30, '#placeholder' => $this->t('Enter module name'), '#attributes' => array('class' => array('table-filter-text'), 'data-table' => '#system-modules-uninstall', 'autocomplete' => 'off', 'title' => $this->t('Enter a part of the module name or description to filter by.')));
     $form['modules'] = array();
     // Only build the rest of the form if there are any modules available to
     // uninstall;
     if (empty($uninstallable)) {
         return $form;
     }
     $profile = drupal_get_profile();
     // Sort all modules by their name.
     uasort($uninstallable, 'system_sort_modules_by_info_name');
     $validation_reasons = $this->moduleInstaller->validateUninstall(array_keys($uninstallable));
     $form['uninstall'] = array('#tree' => TRUE);
     foreach ($uninstallable as $module_key => $module) {
         $name = $module->info['name'] ?: $module->getName();
         $form['modules'][$module->getName()]['#module_name'] = $name;
         $form['modules'][$module->getName()]['name']['#markup'] = $name;
         $form['modules'][$module->getName()]['description']['#markup'] = $this->t($module->info['description']);
         $form['uninstall'][$module->getName()] = array('#type' => 'checkbox', '#title' => $this->t('Uninstall @module module', array('@module' => $name)), '#title_display' => 'invisible');
         // If a validator returns reasons not to uninstall a module,
         // list the reasons and disable the check box.
         if (isset($validation_reasons[$module_key])) {
             $form['modules'][$module->getName()]['#validation_reasons'] = $validation_reasons[$module_key];
             $form['uninstall'][$module->getName()]['#disabled'] = TRUE;
         }
         // All modules which depend on this one must be uninstalled first, before
         // we can allow this module to be uninstalled. (The installation profile
         // is excluded from this list.)
         foreach (array_keys($module->required_by) as $dependent) {
             if ($dependent != $profile && drupal_get_installed_schema_version($dependent) != SCHEMA_UNINSTALLED) {
                 $name = isset($modules[$dependent]->info['name']) ? $modules[$dependent]->info['name'] : $dependent;
                 $form['modules'][$module->getName()]['#required_by'][] = $name;
                 $form['uninstall'][$module->getName()]['#disabled'] = TRUE;
             }
         }
     }
     $form['#attached']['library'][] = 'system/drupal.system.modules';
     $form['actions'] = array('#type' => 'actions');
     $form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Uninstall'));
     return $form;
 }
开发者ID:RealLukeMartin,项目名称:drupal8tester,代码行数:55,代码来源:ModulesUninstallForm.php

示例3: testLocaleTranslationClearCacheProjects

 /**
  * Tests locale_translation_clear_cache_projects().
  */
 public function testLocaleTranslationClearCacheProjects()
 {
     $this->moduleHandler->loadInclude('locale', 'inc', 'locale.translation');
     $expected = [];
     $this->assertIdentical($expected, locale_translation_get_projects());
     $this->projectStorage->set('foo', []);
     $expected['foo'] = new \stdClass();
     $this->assertEqual($expected, locale_translation_get_projects());
     $this->projectStorage->set('bar', []);
     locale_translation_clear_cache_projects();
     $expected['bar'] = new \stdClass();
     $this->assertEqual($expected, locale_translation_get_projects());
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:16,代码来源:LocaleTranslationProjectsTest.php

示例4: loadCachedFormState

 /**
  * Loads the cached form state.
  *
  * @param string $form_build_id
  *   The unique form build ID.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  */
 protected function loadCachedFormState($form_build_id, FormStateInterface $form_state)
 {
     if ($stored_form_state = $this->keyValueExpirableFactory->get('form_state')->get($form_build_id)) {
         // Re-populate $form_state for subsequent rebuilds.
         $form_state->setFormState($stored_form_state);
         // If the original form is contained in include files, load the files.
         // @see \Drupal\Core\Form\FormStateInterface::loadInclude()
         $build_info = $form_state->getBuildInfo();
         $build_info += ['files' => []];
         foreach ($build_info['files'] as $file) {
             if (is_array($file)) {
                 $file += array('type' => 'inc', 'name' => $file['module']);
                 $this->moduleHandler->loadInclude($file['module'], $file['type'], $file['name']);
             } elseif (file_exists($file)) {
                 require_once $this->root . '/' . $file;
             }
         }
         // Retrieve the list of previously known safe strings and store it for
         // this request.
         // @todo Ensure we are not storing an excessively large string list
         //   in: https://www.drupal.org/node/2295823
         $build_info += ['safe_strings' => []];
         SafeMarkup::setMultiple($build_info['safe_strings']);
         unset($build_info['safe_strings']);
         $form_state->setBuildInfo($build_info);
     }
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:35,代码来源:FormCache.php

示例5: getCache

 /**
  * {@inheritdoc}
  */
 public function getCache($form_build_id, &$form_state)
 {
     if ($form = $this->keyValueExpirableFactory->get('form')->get($form_build_id)) {
         $user = $this->currentUser();
         if (isset($form['#cache_token']) && $this->csrfToken->validate($form['#cache_token']) || !isset($form['#cache_token']) && $user->isAnonymous()) {
             if ($stored_form_state = $this->keyValueExpirableFactory->get('form_state')->get($form_build_id)) {
                 // Re-populate $form_state for subsequent rebuilds.
                 $form_state = $stored_form_state + $form_state;
                 // If the original form is contained in include files, load the files.
                 // @see form_load_include()
                 $form_state['build_info'] += array('files' => array());
                 foreach ($form_state['build_info']['files'] as $file) {
                     if (is_array($file)) {
                         $file += array('type' => 'inc', 'name' => $file['module']);
                         $this->moduleHandler->loadInclude($file['module'], $file['type'], $file['name']);
                     } elseif (file_exists($file)) {
                         require_once DRUPAL_ROOT . '/' . $file;
                     }
                 }
                 // Retrieve the list of previously known safe strings and store it
                 // for this request.
                 // @todo Ensure we are not storing an excessively large string list
                 //   in: https://www.drupal.org/node/2295823
                 $form_state['build_info'] += array('safe_strings' => array());
                 SafeMarkup::setMultiple($form_state['build_info']['safe_strings']);
                 unset($form_state['build_info']['safe_strings']);
             }
             return $form;
         }
     }
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:34,代码来源:FormBuilder.php

示例6: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     require_once DRUPAL_ROOT . '/core/includes/install.inc';
     $distribution = SafeMarkup::checkPlain(drupal_install_profile_distribution_name());
     // Include system.admin.inc so we can use the sort callbacks.
     $this->moduleHandler->loadInclude('system', 'inc', 'system.admin');
     $form['filters'] = array('#type' => 'container', '#attributes' => array('class' => array('table-filter', 'js-show')));
     $form['filters']['text'] = array('#type' => 'search', '#title' => $this->t('Search'), '#size' => 30, '#placeholder' => $this->t('Enter module name'), '#attributes' => array('class' => array('table-filter-text'), 'data-table' => '#system-modules', 'autocomplete' => 'off', 'title' => $this->t('Enter a part of the module name or description to filter by.')));
     // Sort all modules by their names.
     $modules = system_rebuild_module_data();
     uasort($modules, 'system_sort_modules_by_info_name');
     // Iterate over each of the modules.
     $form['modules']['#tree'] = TRUE;
     foreach ($modules as $filename => $module) {
         if (empty($module->info['hidden'])) {
             $package = $module->info['package'];
             $form['modules'][$package][$filename] = $this->buildRow($modules, $module, $distribution);
         }
     }
     // Add a wrapper around every package.
     foreach (Element::children($form['modules']) as $package) {
         $form['modules'][$package] += array('#type' => 'details', '#title' => $this->t($package), '#open' => TRUE, '#theme' => 'system_modules_details', '#header' => array(array('data' => $this->t('Installed'), 'class' => array('checkbox', 'visually-hidden')), array('data' => $this->t('Name'), 'class' => array('name', 'visually-hidden')), array('data' => $this->t('Description'), 'class' => array('description', 'visually-hidden', RESPONSIVE_PRIORITY_LOW))), '#attributes' => array('class' => array('package-listing')), '#weight' => $package == 'Core' ? -10 : NULL);
     }
     // If testing modules are shown, collapse the corresponding package by
     // default.
     if (isset($form['modules']['Testing'])) {
         $form['modules']['Testing']['#open'] = FALSE;
     }
     // Lastly, sort all packages by title.
     uasort($form['modules'], array('\\Drupal\\Component\\Utility\\SortArray', 'sortByTitleProperty'));
     $form['#attached']['library'][] = 'system/drupal.system.modules';
     $form['actions'] = array('#type' => 'actions');
     $form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Save configuration'), '#button_type' => 'primary');
     return $form;
 }
开发者ID:brstde,项目名称:gap1,代码行数:38,代码来源:ModulesListForm.php

示例7: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->moduleHandler->loadInclude('locale', 'fetch.inc');
     $this->moduleHandler->loadInclude('locale', 'bulk.inc');
     $langcodes = array_filter($form_state->getValue('langcodes'));
     $projects = array_filter($form_state->getValue('projects_update'));
     // Set the translation import options. This determines if existing
     // translations will be overwritten by imported strings.
     $options = _locale_translation_default_update_options();
     // If the status was updated recently we can immediately start fetching the
     // translation updates. If the status is expired we clear it an run a batch to
     // update the status and then fetch the translation updates.
     $last_checked = $this->state->get('locale.translation_last_checked');
     if ($last_checked < REQUEST_TIME - LOCALE_TRANSLATION_STATUS_TTL) {
         locale_translation_clear_status();
         $batch = locale_translation_batch_update_build(array(), $langcodes, $options);
         batch_set($batch);
     } else {
         // Set a batch to download and import translations.
         $batch = locale_translation_batch_fetch_build($projects, $langcodes, $options);
         batch_set($batch);
         // Set a batch to update configuration as well.
         if ($batch = locale_config_batch_update_components($options, $langcodes)) {
             batch_set($batch);
         }
     }
 }
开发者ID:komejo,项目名称:article-test,代码行数:30,代码来源:TranslationStatusForm.php

示例8: buildTable

 /**
  * Build the list of modules
  * @param array $form
  *   An associative array containing the structure of the form.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  * @param boolean $enabled
  *   Enable the check boxes
  */
 protected function buildTable(array &$form, FormStateInterface $form_state, $enabled)
 {
     $config = $this->config('nagios.settings');
     $header = array('title' => t('Title'), 'description' => t('Description'));
     $options = array();
     // Include system.admin.inc so we can use the sort callbacks.
     $this->moduleHandler->loadInclude('system', 'inc', 'system.admin');
     // Sort all modules by their names.
     $modules = system_rebuild_module_data();
     uasort($modules, 'system_sort_modules_by_info_name');
     // Build the rows
     foreach ($modules as $filename => $module) {
         if (empty($module->info['hidden'])) {
             $options[$filename] = $this->buildRow($modules, $module);
             $options[$filename]['#disabled'] = TRUE;
         }
     }
     // Set up the check boxes
     $defaults = array();
     $nagios_ignored_modules = $config->get('nagios.ignored_modules') ?: array();
     foreach ($nagios_ignored_modules as $ignored_module) {
         $defaults[$ignored_module] = 1;
     }
     $form['modules'] = array('#type' => 'tableselect', '#header' => $header, '#options' => $options, '#empty' => t('No modules available.'), '#default_value' => $defaults);
     if (!$enabled) {
         foreach ($form['modules']['#options'] as $key => $value) {
             $form['modules']['#options']['#disabled'] = TRUE;
         }
     }
 }
开发者ID:ErikWegner,项目名称:drupal_nagios,代码行数:39,代码来源:IgnoredModulesForm.php

示例9: devel_token_object

 private function devel_token_object($entity_type, $entity_id, Request $request)
 {
     $this->moduleHandler->loadInclude('token', 'pages.inc');
     $entity = entity_load($entity_type, $entity_id);
     $header = array(t('Token'), t('Value'));
     $rows = array();
     $options = array('flat' => TRUE, 'values' => TRUE, 'data' => array($entity_type => $entity));
     $tree = token_build_tree($entity_type, $options);
     foreach ($tree as $token => $token_info) {
         if (!empty($token_info['restricted'])) {
             continue;
         }
         if (!isset($token_info['value']) && !empty($token_info['parent']) && !isset($tree[$token_info['parent']]['value'])) {
             continue;
         }
         $row = _token_token_tree_format_row($token, $token_info);
         unset($row['data']['description']);
         unset($row['data']['name']);
         $rows[] = $row;
     }
     $build['tokens'] = array('#theme' => 'tree_table', '#header' => $header, '#rows' => $rows, '#attributes' => array('class' => array('token-tree')), '#empty' => t('No tokens available.'), '#attached' => array('library' => array('token/token')));
     return $build;
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:23,代码来源:TokenDevelController.php

示例10: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Add language, if not yet supported.
     $language = $this->languageManager->getLanguage($form_state->getValue('langcode'));
     if (empty($language)) {
         $language = ConfigurableLanguage::createFromLangcode($form_state->getValue('langcode'));
         $language->save();
         drupal_set_message($this->t('The language %language has been created.', array('%language' => $this->t($language->label()))));
     }
     $options = array('langcode' => $form_state->getValue('langcode'), 'overwrite_options' => $form_state->getValue('overwrite_options'), 'customized' => $form_state->getValue('customized') ? LOCALE_CUSTOMIZED : LOCALE_NOT_CUSTOMIZED);
     $this->moduleHandler->loadInclude('locale', 'bulk.inc');
     $file = locale_translate_file_attach_properties($this->file, $options);
     $batch = locale_translate_batch_build(array($file->uri => $file), $options);
     batch_set($batch);
     $form_state->setRedirect('locale.translate_page');
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:19,代码来源:ImportForm.php

示例11: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, array &$form_state)
 {
     // Add language, if not yet supported.
     $language = $this->languageManager->getLanguage($form_state['values']['langcode']);
     if (empty($language)) {
         $language = new Language(array('id' => $form_state['values']['langcode']));
         $language = language_save($language);
         drupal_set_message($this->t('The language %language has been created.', array('%language' => $this->t($language->name))));
     }
     $options = array('langcode' => $form_state['values']['langcode'], 'overwrite_options' => $form_state['values']['overwrite_options'], 'customized' => $form_state['values']['customized'] ? LOCALE_CUSTOMIZED : LOCALE_NOT_CUSTOMIZED);
     $this->moduleHandler->loadInclude('locale', 'bulk.inc');
     $file = locale_translate_file_attach_properties($this->file, $options);
     $batch = locale_translate_batch_build(array($file->uri => $file), $options);
     batch_set($batch);
     $form_state['redirect_route']['route_name'] = 'locale.translate_page';
 }
开发者ID:shumer,项目名称:blog,代码行数:19,代码来源:ImportForm.php

示例12: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->moduleHandler->loadInclude('update', 'inc', 'update.manager');
     $projects = array();
     foreach (array('projects', 'disabled_projects') as $type) {
         if (!empty($form_state['values'][$type])) {
             $projects = array_merge($projects, array_keys(array_filter($form_state['values'][$type])));
         }
     }
     $operations = array();
     foreach ($projects as $project) {
         $operations[] = array('update_manager_batch_project_get', array($project, $form_state['values']['project_downloads'][$project]));
     }
     $batch = array('title' => $this->t('Downloading updates'), 'init_message' => $this->t('Preparing to download selected updates'), 'operations' => $operations, 'finished' => 'update_manager_download_batch_finished', 'file' => drupal_get_path('module', 'update') . '/update.manager.inc');
     batch_set($batch);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:19,代码来源:UpdateManagerUpdate.php

示例13: page

 /**
  * Shows the status of all required packages.
  *
  * @return array
  *   Returns a render array as expected by drupal_render().
  */
 public function page()
 {
     if (!composer_manager_initialized()) {
         $message = t("Composer Manager needs to be initialized before usage. Run the module's <code>init.sh</code> script or <code>drush composer-manager-init</code> on the command line.");
         drupal_set_message($message, 'warning');
         return array();
     }
     try {
         $packages = $this->packageManager->getRequiredPackages();
     } catch (\RuntimeException $e) {
         drupal_set_message(Xss::filterAdmin($e->getMessage()), 'error');
         $packages = array();
     }
     $rows = array();
     foreach ($packages as $package_name => $package) {
         // Prepare the package name and description.
         if (!empty($package['homepage'])) {
             $options = array('attributes' => array('target' => '_blank'));
             $name = $this->l($package_name, Url::fromUri($package['homepage']), $options);
         } else {
             $name = SafeMarkup::checkPlain($package_name);
         }
         if (!empty($package['description'])) {
             $name .= '<div class="description">' . SafeMarkup::checkPlain($package['description']) . '</div>';
         }
         // Prepare the installed and required versions.
         $installed_version = $package['version'] ? $package['version'] : $this->t('Not installed');
         $required_version = $this->buildRequiredVersion($package['constraint'], $package['required_by']);
         // Prepare the row classes.
         $class = array();
         if (empty($package['version'])) {
             $class[] = 'error';
         } elseif (empty($package['required_by'])) {
             $class[] = 'warning';
         }
         $rows[$package_name] = array('class' => $class, 'data' => array('package' => SafeMarkup::set($name), 'installed_version' => $installed_version, 'required_version' => SafeMarkup::set($required_version)));
     }
     $build = array();
     $build['packages'] = array('#theme' => 'table', '#header' => array('package' => $this->t('Package'), 'installed_version' => $this->t('Installed Version'), 'required_version' => $this->t('Required Version')), '#rows' => $rows, '#caption' => $this->t('Status of Packages Managed by Composer'), '#attributes' => array('class' => array('system-status-report')));
     // Display any errors returned by hook_requirements().
     $this->moduleHandler->loadInclude('composer_manager', 'install');
     $requirements = composer_manager_requirements('runtime');
     if ($requirements['composer_manager']['severity'] == REQUIREMENT_ERROR) {
         drupal_set_message($requirements['composer_manager']['description'], 'warning');
     }
     return $build;
 }
开发者ID:jeyram,项目名称:camp-gdl,代码行数:53,代码来源:PackageController.php

示例14: page

 /**
  * Shows the status of all required packages.
  *
  * @return array
  *   Returns a render array as expected by drupal_render().
  */
 public function page()
 {
     if (!composer_manager_initialized()) {
         $message = t("Composer Manager needs to be initialized before usage. Run the module's <code>init.php</code> script on the command line.");
         drupal_set_message($message, 'warning');
         return [];
     }
     try {
         $packages = $this->packageManager->getRequiredPackages();
     } catch (\RuntimeException $e) {
         drupal_set_message(Xss::filterAdmin($e->getMessage()), 'error');
         return [];
     }
     $rows = [];
     foreach ($packages as $package_name => $package) {
         $package_column = [];
         if (!empty($package['homepage'])) {
             $package_column[] = ['#type' => 'link', '#title' => $package_name, '#url' => Url::fromUri($package['homepage']), '#options' => ['attributes' => ['target' => '_blank']]];
         } else {
             $package_column[] = ['#plain_text' => $package_name];
         }
         if (!empty($package['description'])) {
             $package_column[] = ['#prefix' => '<div class="description">', '#plain_text' => $package['description'], '#suffix' => '</div>'];
         }
         // Prepare the installed and required versions.
         $installed_version = $package['version'] ? $package['version'] : $this->t('Not installed');
         $required_version = $this->buildRequiredVersion($package['constraint'], $package['required_by']);
         // Prepare the row classes.
         $class = [];
         if (empty($package['version'])) {
             $class[] = 'error';
         } elseif (empty($package['required_by'])) {
             $class[] = 'warning';
         }
         $rows[$package_name] = ['class' => $class, 'data' => ['package' => ['data' => $package_column], 'installed_version' => $installed_version, 'required_version' => ['data' => $required_version]]];
     }
     $build = [];
     $build['packages'] = ['#theme' => 'table', '#header' => ['package' => $this->t('Package'), 'installed_version' => $this->t('Installed Version'), 'required_version' => $this->t('Required Version')], '#rows' => $rows, '#caption' => $this->t('Status of Packages Managed by Composer'), '#attributes' => ['class' => ['system-status-report']]];
     // Display any errors returned by hook_requirements().
     $this->moduleHandler->loadInclude('composer_manager', 'install');
     $requirements = composer_manager_requirements('runtime');
     if ($requirements['composer_manager']['severity'] == REQUIREMENT_ERROR) {
         drupal_set_message($requirements['composer_manager']['description'], 'warning');
     }
     return $build;
 }
开发者ID:DenLilleMand,项目名称:christianssite,代码行数:52,代码来源:PackageController.php

示例15: loadCachedFormState

 /**
  * Loads the cached form state.
  *
  * @param string $form_build_id
  *   The unique form build ID.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  */
 protected function loadCachedFormState($form_build_id, FormStateInterface $form_state)
 {
     if ($stored_form_state = $this->keyValueExpirableFactory->get('form_state')->get($form_build_id)) {
         // Re-populate $form_state for subsequent rebuilds.
         $form_state->setFormState($stored_form_state);
         // If the original form is contained in include files, load the files.
         // @see \Drupal\Core\Form\FormStateInterface::loadInclude()
         $build_info = $form_state->getBuildInfo();
         $build_info += ['files' => []];
         foreach ($build_info['files'] as $file) {
             if (is_array($file)) {
                 $file += array('type' => 'inc', 'name' => $file['module']);
                 $this->moduleHandler->loadInclude($file['module'], $file['type'], $file['name']);
             } elseif (file_exists($file)) {
                 require_once $this->root . '/' . $file;
             }
         }
     }
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:27,代码来源:FormCache.php


注:本文中的Drupal\Core\Extension\ModuleHandlerInterface::loadInclude方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。