本文整理汇总了PHP中Drupal\Core\Extension\ModuleHandlerInterface类的典型用法代码示例。如果您正苦于以下问题:PHP ModuleHandlerInterface类的具体用法?PHP ModuleHandlerInterface怎么用?PHP ModuleHandlerInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleHandlerInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* {@inheritdoc}
*/
public function __construct(ModuleHandlerInterface $module_handler)
{
$this->alterInfo('rules_event');
$this->discovery = new ContainerDerivativeDiscoveryDecorator(new YamlDiscovery('rules.events', $module_handler->getModuleDirectories()));
$this->factory = new ContainerFactory($this, RulesEventInterface::class);
$this->moduleHandler = $module_handler;
}
开发者ID:DrupalTV,项目名称:DrupalTV,代码行数:10,代码来源:RulesEventManager.php
示例2: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
// Create a config mock which does not mock the clear(), set() and get() methods.
$methods = get_class_methods('Drupal\\Core\\Config\\Config');
unset($methods[array_search('set', $methods)]);
unset($methods[array_search('get', $methods)]);
unset($methods[array_search('clear', $methods)]);
$config_mock = $this->getMockBuilder('Drupal\\Core\\Config\\Config')->disableOriginalConstructor()->setMethods($methods)->getMock();
// Create the config factory we use in the submitForm() function.
$this->configFactory = $this->getMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
$this->configFactory->expects($this->any())->method('getEditable')->will($this->returnValue($config_mock));
// Create a MailsystemManager mock.
$this->mailManager = $this->getMock('\\Drupal\\mailsystem\\MailsystemManager', array(), array(), '', FALSE);
$this->mailManager->expects($this->any())->method('getDefinition')->will($this->returnValueMap(array(array('mailsystem_test', TRUE, array('label' => 'Test Mail-Plugin')), array('mailsystem_demo', TRUE, array('label' => 'Demo Mail-Plugin')))));
$this->mailManager->expects($this->any())->method('getDefinitions')->will($this->returnValue(array(array('id' => 'mailsystem_test', 'label' => 'Test Mail-Plugin'), array('id' => 'mailsystem_demo', 'label' => 'Demo Mail-Plugin'))));
// Create a module handler mock.
$this->moduleHandler = $this->getMock('\\Drupal\\Core\\Extension\\ModuleHandlerInterface');
$this->moduleHandler->expects($this->any())->method('getImplementations')->with('mail')->will($this->returnValue(array('mailsystem_test', 'mailsystem_demo')));
$this->moduleHandler->expects($this->any())->method('moduleExists')->withAnyParameters()->will($this->returnValue(FALSE));
// Create a theme handler mock.
$this->themeHandler = $this->getMock('\\Drupal\\Core\\Extension\\ThemeHandlerInterface');
$this->themeHandler->expects($this->any())->method('listInfo')->will($this->returnValue(array('test_theme' => (object) array('status' => 1, 'info' => array('name' => 'test theme name')), 'demo_theme' => (object) array('status' => 1, 'info' => array('name' => 'test theme name demo')), 'inactive_theme' => (object) array('status' => 0, 'info' => array('name' => 'inactive test theme')))));
// Inject a language-manager into \Drupal.
$this->languageManager = $this->getMock('\\Drupal\\Core\\StringTranslation\\TranslationInterface');
$this->languageManager->expects($this->any())->method('translate')->withAnyParameters()->will($this->returnArgument(0));
$container = new ContainerBuilder();
$container->set('string_translation', $this->languageManager);
\Drupal::setContainer($container);
}
开发者ID:augustpascual-mse,项目名称:job-searching-network,代码行数:32,代码来源:AdminFormTest.php
示例3: __construct
/**
* Constructs a ConfigMapperManager.
*
* @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
* The cache backend.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
* The typed config manager.
*/
public function __construct(CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler, TypedConfigManagerInterface $typed_config_manager, ThemeHandlerInterface $theme_handler)
{
$this->typedConfigManager = $typed_config_manager;
// Look at all themes and modules.
// @todo If the list of enabled modules and themes is changed, new
// definitions are not picked up immediately and obsolete definitions are
// not removed, because the list of search directories is only compiled
// once in this constructor. The current code only works due to
// coincidence: The request that enables e.g. a new theme does not
// instantiate this plugin manager at the beginning of the request; when
// routes are being rebuilt at the end of the request, this service only
// happens to get instantiated with the updated list of enabled themes.
$directories = array();
foreach ($module_handler->getModuleList() as $name => $module) {
$directories[$name] = $module->getPath();
}
foreach ($theme_handler->listInfo() as $theme) {
$directories[$theme->getName()] = $theme->getPath();
}
// Check for files named MODULE.config_translation.yml and
// THEME.config_translation.yml in module/theme roots.
$this->discovery = new YamlDiscovery('config_translation', $directories);
$this->discovery = new InfoHookDecorator($this->discovery, 'config_translation_info');
$this->discovery = new ContainerDerivativeDiscoveryDecorator($this->discovery);
$this->factory = new ContainerFactory($this);
// Let others alter definitions with hook_config_translation_info_alter().
$this->moduleHandler = $module_handler;
$this->themeHandler = $theme_handler;
$this->alterInfo('config_translation_info');
// Config translation only uses an info hook discovery, cache by language.
$cache_key = 'config_translation_info_plugins' . ':' . $language_manager->getCurrentLanguage()->getId();
$this->setCacheBackend($cache_backend, $cache_key, array('config_translation_info_plugins' => TRUE));
}
开发者ID:anatalsceo,项目名称:en-classe,代码行数:45,代码来源:ConfigMapperManager.php
示例4: __construct
/**
* Constructs a TwigEnvironment object and stores cache and storage
* internally.
*/
public function __construct(\Twig_LoaderInterface $loader = NULL, $options = array(), ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler)
{
// @todo Pass as arguments from the DIC.
$this->cache_object = \Drupal::cache();
// Ensure that twig.engine is loaded, given that it is needed to render a
// template because functions like twig_drupal_escape_filter are called.
require_once DRUPAL_ROOT . '/core/themes/engines/twig/twig.engine';
// Set twig path namespace for themes and modules.
$namespaces = array();
foreach ($module_handler->getModuleList() as $name => $extension) {
$namespaces[$name] = $extension->getPath();
}
foreach ($theme_handler->listInfo() as $name => $extension) {
$namespaces[$name] = $extension->getPath();
}
foreach ($namespaces as $name => $path) {
$templatesDirectory = $path . '/templates';
if (file_exists($templatesDirectory)) {
$loader->addPath($templatesDirectory, $name);
}
}
$this->templateClasses = array();
$this->stringLoader = new \Twig_Loader_String();
parent::__construct($loader, $options);
}
开发者ID:anatalsceo,项目名称:en-classe,代码行数:29,代码来源:TwigEnvironment.php
示例5:
function __construct(EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler)
{
$this->entityManger = $entity_manager;
$this->moduleHandler = $module_handler;
if ($this->entityManger && $this->moduleHandler->moduleExists('taxonomy')) {
$this->termStorage = $this->entityManger->getStorage('taxonomy_term');
$this->vocabularyStorage = $this->entityManger->getStorage('taxonomy_vocabulary');
}
}
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:9,代码来源:NameOptionsProvider.php
示例6: enhance
/**
* {@inheritdoc}
*/
public function enhance(array $defaults, Request $request)
{
if (!$this->moduleHandler->moduleExists('ctools')) {
$defaults['_controller'] = '\\Drupal\\entity_browser\\Controllers\\CtoolsFallback::displayMessage';
}
return $defaults;
}
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:10,代码来源:CtoolsFallbackRouteEnhancer.php
示例7: save
/**
* {@inheritdoc}
*/
public function save(array $link)
{
$link += array('access' => 1, 'status' => 1, 'status_override' => 0, 'lastmod' => 0, 'priority' => XMLSITEMAP_PRIORITY_DEFAULT, 'priority_override' => 0, 'changefreq' => 0, 'changecount' => 0, 'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED);
// Allow other modules to alter the link before saving.
$this->moduleHandler->alter('xmlsitemap_link', $link);
// Temporary validation checks.
// @todo Remove in final?
if ($link['priority'] < 0 || $link['priority'] > 1) {
trigger_error(t('Invalid sitemap link priority %priority.<br />@link', array('%priority' => $link['priority'], '@link' => var_export($link, TRUE))), E_USER_ERROR);
}
if ($link['changecount'] < 0) {
trigger_error(t('Negative changecount value. Please report this to <a href="@516928">@516928</a>.<br />@link', array('@516928' => 'http://drupal.org/node/516928', '@link' => var_export($link, TRUE))), E_USER_ERROR);
$link['changecount'] = 0;
}
// Check if this is a changed link and set the regenerate flag if necessary.
if (!$this->state->get('xmlsitemap_regenerate_needed')) {
$this->checkChangedLink($link, NULL, TRUE);
}
$queryStatus = \Drupal::database()->merge('xmlsitemap')->key(array('type' => $link['type'], 'id' => $link['id']))->fields(array('loc' => $link['loc'], 'subtype' => $link['subtype'], 'access' => $link['access'], 'status' => $link['status'], 'status_override' => $link['status_override'], 'lastmod' => $link['lastmod'], 'priority' => $link['priority'], 'priority_override' => $link['priority_override'], 'changefreq' => $link['changefreq'], 'changecount' => $link['changecount'], 'language' => $link['language']))->execute();
switch ($queryStatus) {
case Merge::STATUS_INSERT:
$this->moduleHandler->invokeAll('xmlsitemap_link_insert', array($link));
break;
case Merge::STATUS_UPDATE:
$this->moduleHandler->invokeAll('xmlsitemap_link_update', array($link));
break;
}
return $link;
}
开发者ID:jeroenos,项目名称:jeroenos_d8.mypressonline.com,代码行数:32,代码来源:XmlSitemapLinkStorage.php
示例8: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state)
{
$config = $this->config('xhprof.config');
$extension_loaded = $this->profiler->isLoaded();
if ($extension_loaded) {
$help = $this->t('Profile requests with the XHProf or uprofiler php extension.');
} else {
$help = $this->t('You must enable the !xhprof or !uprofiler php extension.', ['!xhprof' => $this->l('XHProf', Url::fromUri('https://www.drupal.org/node/946182')), '!uprofiler' => $this->l('uprofiler', Url::fromUri('https://github.com/FriendsOfPHP/uprofiler'))]);
}
$form['help'] = array('#type' => 'inline_template', '#template' => '<span class="warning">{{ help }}</span>', '#context' => array('help' => $help));
$form['enabled'] = array('#type' => 'checkbox', '#title' => $this->t('Enable profiling of page views.'), '#default_value' => $extension_loaded & $config->get('enabled'), '#disabled' => !$extension_loaded);
$form['settings'] = array('#title' => $this->t('Profiling settings'), '#type' => 'details', '#open' => TRUE, '#states' => array('invisible' => array('input[name="enabled"]' => array('checked' => FALSE))));
$form['settings']['extension'] = array('#type' => 'select', '#title' => $this->t('Extension'), '#options' => $this->profiler->getExtensions(), '#default_value' => $config->get('extension'), '#description' => $this->t('Choose the extension to use for profiling. The recommended extension is !uprofiler because it is actively maintained.', ['!uprofiler' => $this->l('uprofiler', Url::fromUri('https://github.com/FriendsOfPHP/uprofiler'))]));
$form['settings']['exclude'] = array('#type' => 'textarea', '#title' => $this->t('Exclude'), '#default_value' => $config->get('exclude'), '#description' => $this->t('Path to exclude for profiling. One path per line.'));
$form['settings']['interval'] = array('#type' => 'number', '#title' => 'Profiling interval', '#min' => 0, '#default_value' => $config->get('interval'), '#description' => $this->t('The approximate number of requests between XHProf samples. Leave zero to profile all requests.'));
$flags = array('FLAGS_CPU' => $this->t('Cpu'), 'FLAGS_MEMORY' => $this->t('Memory'), 'FLAGS_NO_BUILTINS' => $this->t('Exclude PHP builtin functions'));
$form['settings']['flags'] = array('#type' => 'checkboxes', '#title' => 'Profile', '#options' => $flags, '#default_value' => $config->get('flags'), '#description' => $this->t('Flags to choose what profile.'));
$form['settings']['exclude_indirect_functions'] = array('#type' => 'checkbox', '#title' => 'Exclude indirect functions', '#default_value' => $config->get('exclude_indirect_functions'), '#description' => $this->t('Exclude functions like %call_user_func and %call_user_func_array.', array('%call_user_func' => 'call_user_func', '%call_user_func_array' => 'call_user_func_array')));
$options = $this->storageManager->getStorages();
$form['settings']['storage'] = array('#type' => 'radios', '#title' => $this->t('Profile storage'), '#default_value' => $config->get('storage'), '#options' => $options, '#description' => $this->t('Choose the storage class.'));
if ($this->moduleHandler->moduleExists('webprofiler')) {
$form['webprofiler'] = array('#title' => $this->t('Webprofiler integration'), '#type' => 'details', '#open' => TRUE, '#states' => array('invisible' => array('input[name="enabled"]' => array('checked' => FALSE))));
$form['webprofiler']['show_summary_toolbar'] = array('#type' => 'checkbox', '#title' => $this->t('Show summary data in toolbar.'), '#default_value' => $config->get('show_summary_toolbar'), '#description' => $this->t('Show data from the overall summary directly into the Webprofiler toolbar. May slow down the toolbar rendering.'));
}
return parent::buildForm($form, $form_state);
}
开发者ID:shahinam,项目名称:drupal8devel,代码行数:29,代码来源:ConfigForm.php
示例9: alterRoutes
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection)
{
foreach ($collection as $name => $route) {
if ($route->hasRequirement('_module_dependencies')) {
$modules = $route->getRequirement('_module_dependencies');
$explode_and = $this->explodeString($modules, '+');
if (count($explode_and) > 1) {
foreach ($explode_and as $module) {
// If any moduleExists() call returns FALSE, remove the route and
// move on to the next.
if (!$this->moduleHandler->moduleExists($module)) {
$collection->remove($name);
continue 2;
}
}
} else {
// OR condition, exploding on ',' character.
foreach ($this->explodeString($modules, ',') as $module) {
if ($this->moduleHandler->moduleExists($module)) {
continue 2;
}
}
// If no modules are found, and we get this far, remove the route.
$collection->remove($name);
}
}
}
}
开发者ID:eigentor,项目名称:tommiblog,代码行数:31,代码来源:ModuleRouteSubscriber.php
示例10: 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
示例11: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$modules = array_filter($form_state['values']['list']);
$this->moduleHandler->uninstall($modules, FALSE);
$this->moduleHandler->install($modules, FALSE);
drupal_set_message(t('Uninstalled and installed: %names.', array('%names' => implode(', ', $modules))));
}
开发者ID:anatalsceo,项目名称:en-classe,代码行数:10,代码来源:DevelReinstall.php
示例12: testGetOperations
/**
* @covers ::getOperations
*/
public function testGetOperations()
{
$operation_name = $this->randomMachineName();
$operations = array($operation_name => array('title' => $this->randomMachineName()));
$this->moduleHandler->expects($this->once())->method('invokeAll')->with('entity_operation', array($this->role))->will($this->returnValue($operations));
$this->moduleHandler->expects($this->once())->method('alter')->with('entity_operation');
$this->container->set('module_handler', $this->moduleHandler);
$this->role->expects($this->any())->method('access')->will($this->returnValue(AccessResult::allowed()));
$this->role->expects($this->any())->method('hasLinkTemplate')->will($this->returnValue(TRUE));
$url = $this->getMockBuilder('\\Drupal\\Core\\Url')->disableOriginalConstructor()->getMock();
$url->expects($this->any())->method('toArray')->will($this->returnValue(array()));
$this->role->expects($this->any())->method('urlInfo')->will($this->returnValue($url));
$list = new EntityListBuilder($this->entityType, $this->roleStorage, $this->moduleHandler);
$list->setStringTranslation($this->translationManager);
$operations = $list->getOperations($this->role);
$this->assertInternalType('array', $operations);
$this->assertArrayHasKey('edit', $operations);
$this->assertInternalType('array', $operations['edit']);
$this->assertArrayHasKey('title', $operations['edit']);
$this->assertArrayHasKey('delete', $operations);
$this->assertInternalType('array', $operations['delete']);
$this->assertArrayHasKey('title', $operations['delete']);
$this->assertArrayHasKey($operation_name, $operations);
$this->assertInternalType('array', $operations[$operation_name]);
$this->assertArrayHasKey('title', $operations[$operation_name]);
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:29,代码来源:EntityListBuilderTest.php
示例13: transform
/**
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property)
{
list($old_visibility, $pages, $roles) = $value;
$visibility = array();
// If the block is assigned to specific roles, add the user_role condition.
if ($roles) {
$visibility['user_role'] = array('id' => 'user_role', 'roles' => array(), 'context_mapping' => array('user' => '@user.current_user_context:current_user'), 'negate' => FALSE);
foreach ($roles as $key => $role_id) {
$roles[$key] = $this->migrationPlugin->transform($role_id, $migrate_executable, $row, $destination_property);
}
$visibility['user_role']['roles'] = array_combine($roles, $roles);
}
if ($pages) {
// 2 == BLOCK_VISIBILITY_PHP in Drupal 6 and 7.
if ($old_visibility == 2) {
// If the PHP module is present, migrate the visibility code unaltered.
if ($this->moduleHandler->moduleExists('php')) {
$visibility['php'] = array('id' => 'php', 'negate' => FALSE, 'php' => $pages);
} elseif ($this->skipPHP) {
throw new MigrateSkipRowException();
}
} else {
$paths = preg_split("(\r\n?|\n)", $pages);
foreach ($paths as $key => $path) {
$paths[$key] = $path === '<front>' ? $path : '/' . ltrim($path, '/');
}
$visibility['request_path'] = array('id' => 'request_path', 'negate' => !$old_visibility, 'pages' => implode("\n", $paths));
}
}
return $visibility;
}
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:34,代码来源:BlockVisibility.php
示例14: guess
/**
* {@inheritdoc}
*/
public function guess($path)
{
if ($this->mapping === NULL) {
$mapping = $this->defaultMapping;
// Allow modules to alter the default mapping.
$this->moduleHandler->alter('file_mimetype_mapping', $mapping);
$this->mapping = $mapping;
}
$extension = '';
$file_parts = explode('.', drupal_basename($path));
// Remove the first part: a full filename should not match an extension.
array_shift($file_parts);
// Iterate over the file parts, trying to find a match.
// For my.awesome.image.jpeg, we try:
// - jpeg
// - image.jpeg, and
// - awesome.image.jpeg
while ($additional_part = array_pop($file_parts)) {
$extension = strtolower($additional_part . ($extension ? '.' . $extension : ''));
if (isset($this->mapping['extensions'][$extension])) {
return $this->mapping['mimetypes'][$this->mapping['extensions'][$extension]];
}
}
return 'application/octet-stream';
}
开发者ID:ddrozdik,项目名称:dmaps,代码行数:28,代码来源:ExtensionMimeTypeGuesser.php
示例15: testGetRegistryForModule
/**
* Tests getting the theme registry defined by a module.
*/
public function testGetRegistryForModule()
{
$this->setupTheme('test_theme');
$this->registry->setTheme(new ActiveTheme(['name' => 'test_theme', 'path' => 'core/modules/system/tests/themes/test_theme/test_theme.info.yml', 'engine' => 'twig', 'owner' => 'twig', 'stylesheets_remove' => [], 'stylesheets_override' => [], 'libraries' => [], 'extension' => '.twig', 'base_themes' => []]));
// Include the module so that hook_theme can be called.
include_once $this->root . '/core/modules/system/tests/modules/theme_test/theme_test.module';
$this->moduleHandler->expects($this->once())->method('getImplementations')->with('theme')->will($this->returnValue(array('theme_test')));
$registry = $this->registry->get();
// Ensure that the registry entries from the module are found.
$this->assertArrayHasKey('theme_test', $registry);
$this->assertArrayHasKey('theme_test_template_test', $registry);
$this->assertArrayHasKey('theme_test_template_test_2', $registry);
$this->assertArrayHasKey('theme_test_suggestion_provided', $registry);
$this->assertArrayHasKey('theme_test_specific_suggestions', $registry);
$this->assertArrayHasKey('theme_test_suggestions', $registry);
$this->assertArrayHasKey('theme_test_function_suggestions', $registry);
$this->assertArrayHasKey('theme_test_foo', $registry);
$this->assertArrayHasKey('theme_test_render_element', $registry);
$this->assertArrayHasKey('theme_test_render_element_children', $registry);
$this->assertArrayHasKey('theme_test_function_template_override', $registry);
$this->assertArrayNotHasKey('test_theme_not_existing_function', $registry);
$info = $registry['theme_test_function_suggestions'];
$this->assertEquals('module', $info['type']);
$this->assertEquals('core/modules/system/tests/modules/theme_test', $info['theme path']);
$this->assertEquals('theme_theme_test_function_suggestions', $info['function']);
$this->assertEquals(array(), $info['variables']);
}
开发者ID:nstielau,项目名称:drops-8,代码行数:30,代码来源:RegistryTest.php
示例16: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
$modules = $input->getArgument('module');
if (!$this->lock->acquire('cron', 900.0)) {
$io->warning($this->trans('commands.cron.execute.messages.lock'));
return 1;
}
if (in_array('all', $modules)) {
$modules = $this->moduleHandler->getImplementations('cron');
}
foreach ($modules as $module) {
if (!$this->moduleHandler->implementsHook($module, 'cron')) {
$io->warning(sprintf($this->trans('commands.cron.execute.messages.module-invalid'), $module));
continue;
}
try {
$io->info(sprintf($this->trans('commands.cron.execute.messages.executing-cron'), $module));
$this->moduleHandler->invoke($module, 'cron');
} catch (\Exception $e) {
watchdog_exception('cron', $e);
$io->error($e->getMessage());
}
}
$this->state->set('system.cron_last', REQUEST_TIME);
$this->lock->release('cron');
$this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']);
$io->success($this->trans('commands.cron.execute.messages.success'));
return 0;
}
开发者ID:ddrozdik,项目名称:DrupalConsole,代码行数:33,代码来源:ExecuteCommand.php
示例17: testGetDefinitions
/**
* @covers ::getDefinitions
*/
public function testGetDefinitions()
{
$definitions = array('foo' => array('label' => $this->randomMachineName()));
$this->discovery->expects($this->once())->method('getDefinitions')->willReturn($definitions);
$this->moduleHandler->expects($this->once())->method('alter')->with('payment_line_item');
$this->assertSame($definitions, $this->sut->getDefinitions());
}
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:10,代码来源:PaymentLineItemManagerTest.php
示例18: getProviderLabel
/**
* Gets the human-readable provider label.
*
* @param $provider string
*
* @return string
*/
protected function getProviderLabel($provider)
{
if ($provider == 'core') {
return $this->t('Core');
} else {
return $this->moduleHandler->getName($provider);
}
}
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:15,代码来源:ListBase.php
示例19: tokenBrowser
/**
* Gatekeeper function to direct to either the core or contributed Token.
*
* @return array
* If token module is installed, a popup browser plus a help text. If not
* only the help text.
*/
public function tokenBrowser()
{
$form = array();
$form['intro_text'] = array('#markup' => '<p>' . t('Configure the meta tags below. Use tokens to avoid redundant meta data and search engine penalization. For example, a \'keyword\' value of "example" will be shown on all content using this configuration, whereas using the [node:field_keywords] automatically inserts the "keywords" values from the current entity (node, term, etc).') . '</p>');
if ($this->moduleHandler->moduleExists('token')) {
$form['tokens'] = array('#theme' => 'token_tree_link', '#token_types' => 'all', '#global_types' => TRUE, '#click_insert' => TRUE, '#show_restricted' => FALSE, '#recursion_limit' => 3, '#text' => t('Browse available tokens'));
}
return $form;
}
开发者ID:k-zafar,项目名称:barney_river,代码行数:16,代码来源:MetatagToken.php
示例20: tokenBrowser
/**
* Gatekeeper function to direct to either the core or contributed Token.
*
* @return mixed
*/
public function tokenBrowser()
{
// @TODO: Make these optionally return rendered HTML instead of an an array.
if ($this->moduleHandler->moduleExists('token')) {
return $this->contribBrowser();
} else {
return $this->coreBrowser();
}
}
开发者ID:dmyerson,项目名称:d8ecs,代码行数:14,代码来源:MetatagToken.php
注:本文中的Drupal\Core\Extension\ModuleHandlerInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论