本文整理汇总了PHP中system_get_info函数的典型用法代码示例。如果您正苦于以下问题:PHP system_get_info函数的具体用法?PHP system_get_info怎么用?PHP system_get_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了system_get_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Prints a listing of admin tasks, organized by module.
*
* @return array
* A render array containing the listing.
*/
public function index()
{
$module_info = system_get_info('module');
foreach ($module_info as $module => $info) {
$module_info[$module] = new \stdClass();
$module_info[$module]->info = $info;
}
uasort($module_info, 'system_sort_modules_by_info_name');
$menu_items = array();
foreach ($module_info as $module => $info) {
// Only display a section if there are any available tasks.
if ($admin_tasks = system_get_module_admin_tasks($module, $info->info)) {
// Sort links by title.
uasort($admin_tasks, array('\\Drupal\\Component\\Utility\\SortArray', 'sortByTitleElement'));
// Move 'Configure permissions' links to the bottom of each section.
$permission_key = "user.admin_permissions.{$module}";
if (isset($admin_tasks[$permission_key])) {
$permission_task = $admin_tasks[$permission_key];
unset($admin_tasks[$permission_key]);
$admin_tasks[$permission_key] = $permission_task;
}
$menu_items[$info->info['name']] = array($info->info['description'], $admin_tasks);
}
}
$output = array('#theme' => 'system_admin_index', '#menu_items' => $menu_items);
return $output;
}
示例2: getLibraryDependencies
/**
* {@inheritdoc}
*
* @todo Determine whether this needs to be cached.
*/
public function getLibraryDependencies()
{
// @todo Make this unit-testable.
$info = system_get_info($this->getType(), $this->getName());
assert('!empty($info)');
return isset($info['library_dependencies']) ? $info['library_dependencies'] : [];
}
示例3: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $bundle_name = NULL) {
$this->currentBundle = $this->assigner->loadBundle($bundle_name);
$settings = $this->currentBundle->getAssignmentSettings(self::METHOD_ID);
$this->setTypeSelect($form, $settings['types'], $this->t('exclude'));
$module_settings = $settings['module'];
$curated_settings = $settings['curated'];
$form['curated'] = array(
'#type' => 'checkbox',
'#title' => t('Exclude designated site-specific configuration'),
'#default_value' => $curated_settings,
'#description' => $this->t('Select this option to exclude from packaging items on a curated list of site-specific configuration.'),
);
$form['module'] = array(
'#type' => 'container',
'#tree' => TRUE,
);
$form['module']['enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Exclude module-provided entity configuration'),
'#default_value' => $module_settings['enabled'],
'#description' => $this->t('Select this option to exclude from packaging any configuration that is provided by already enabled modules. Note that <a href="!url">simple configuration</a> will not be excluded as it is always module-provided.', array('!url' => 'http://www.drupal.org/node/1809490')),
'#attributes' => array(
'data-module-enabled' => 'status',
),
);
$show_if_module_enabled_checked = array(
'visible' => array(
':input[data-module-enabled="status"]' => array('checked' => TRUE),
),
);
$info = system_get_info('module', drupal_get_profile());
$form['module']['profile'] = array(
'#type' => 'checkbox',
'#title' => t("Don't exclude install profile's configuration"),
'#default_value' => $module_settings['profile'],
'#description' => $this->t("Select this option to not exclude from packaging any configuration that is provided by this site's install profile, %profile.", array('%profile' => $info['name'])),
'#states' => $show_if_module_enabled_checked,
);
$machine_name = $this->currentBundle->getMachineName();
$machine_name = !empty($machine_name) ? $machine_name : t('none');
$form['module']['namespace'] = array(
'#type' => 'checkbox',
'#title' => t("Don't exclude configuration by namespace"),
'#default_value' => $module_settings['namespace'],
'#description' => $this->t("Select this option to not exclude from packaging any configuration that is provided by modules with the package namespace (currently %namespace).", array('%namespace' => $machine_name)),
'#states' => $show_if_module_enabled_checked,
);
$this->setActions($form);
return $form;
}
示例4: getLibraryDependencies
/**
* {@inheritdoc}
*
* @todo Determine whether this needs to be cached.
*/
public function getLibraryDependencies() {
// @todo Make this unit-testable.
$type = $this->getType();
// system_get_info() lists profiles as type "module"
$type = $type == 'profile' ? 'module' : $type;
$info = system_get_info($type, $this->getName());
assert('!empty($info)');
return isset($info['library_dependencies']) ? $info['library_dependencies'] : [];
}
示例5: buildOptionsForm
/**
* Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::defineOptions().
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state)
{
parent::buildOptionsForm($form, $form_state);
$modules = system_get_info('module');
$names = array();
foreach ($modules as $name => $module) {
$names[$name] = $module['name'];
}
$form['data_module'] = array('#title' => $this->t('Module name'), '#type' => 'select', '#description' => $this->t('The module which sets this user data.'), '#default_value' => $this->options['data_module'], '#options' => $names);
$form['data_name'] = array('#title' => $this->t('Name'), '#type' => 'textfield', '#description' => $this->t('The name of the data key.'), '#default_value' => $this->options['data_name']);
}
示例6: getModuleName
/**
* Gets the name of the module.
*
* @param string $module
* The machine name of a module.
*
* @return string
* The human-readable module name if it exists, otherwise the
* machine-readable module name.
*/
protected function getModuleName($module)
{
// Gather module data.
if (!isset($this->moduleData)) {
$this->moduleData = system_get_info('module');
}
// If the module exists, return its human-readable name.
if (isset($this->moduleData[$module])) {
return $this->t($this->moduleData[$module]['name']);
}
// Otherwise, return the machine name.
return $module;
}
示例7: getValueOptions
public function getValueOptions()
{
if (!isset($this->valueOptions)) {
$module_info = system_get_info('module');
$permissions = $this->permissionHandler->getPermissions();
foreach ($permissions as $perm => $perm_item) {
$provider = $perm_item['provider'];
$display_name = $module_info[$provider]['name'];
$this->valueOptions[$display_name][$perm] = String::checkPlain(strip_tags($perm_item['title']));
}
} else {
return $this->valueOptions;
}
}
示例8: buildOptionsForm
public function buildOptionsForm(&$form, &$form_state)
{
parent::buildOptionsForm($form, $form_state);
$perms = array();
$module_info = system_get_info('module');
// Get list of permissions
foreach (\Drupal::moduleHandler()->getImplementations('permission') as $module) {
$permissions = \Drupal::moduleHandler()->invoke($module, 'permission');
foreach ($permissions as $name => $perm) {
$perms[$module_info[$module]['name']][$name] = strip_tags($perm['title']);
}
}
ksort($perms);
$form['perm'] = array('#type' => 'select', '#options' => $perms, '#title' => t('Permission'), '#default_value' => $this->options['perm'], '#description' => t('Only users with the selected permission flag will be able to access this display. Note that users with "access all views" can see any view, regardless of other permissions.'));
}
示例9: buildOptionsForm
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state)
{
$form['type'] = array('#type' => 'radios', '#title' => t('Type of user filter value to allow'), '#options' => array('uid' => t('Only allow numeric UIDs'), 'name' => t('Only allow string usernames'), 'either' => t('Allow both numeric UIDs and string usernames')), '#default_value' => $this->options['type']);
$perms = array();
$module_info = system_get_info('module');
// Get list of permissions
$module_handler = \Drupal::moduleHandler();
foreach ($module_handler->getImplementations('permission') as $module) {
$permissions = $module_handler->invoke($module, 'permission');
foreach ($permissions as $name => $perm) {
$perms[$module_info[$module]['name']][$name] = strip_tags($perm['title']);
}
}
asort($perms);
$form['perm'] = array('#type' => 'select', '#options' => $perms, '#title' => t('Permission'), '#default_value' => $this->options['perm'], '#description' => t('Users with the selected permission flag will be able to bypass validation.'));
}
示例10: testDisableRequired
/**
* Assert that core required modules cannot be disabled.
*/
function testDisableRequired()
{
$module_info = system_get_info('module');
$this->drupalGet('admin/modules');
foreach ($module_info as $module => $info) {
// Check to make sure the checkbox for each required module is disabled
// and checked (or absent from the page if the module is also hidden).
if (!empty($info['required'])) {
$field_name = "modules[{$info['package']}][{$module}][enable]";
if (empty($info['hidden'])) {
$this->assertFieldByXPath("//input[@name='{$field_name}' and @disabled='disabled' and @checked='checked']", '', format_string('Field @name was disabled and checked.', array('@name' => $field_name)));
} else {
$this->assertNoFieldByName($field_name);
}
}
}
}
示例11: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $bundle_name = NULL)
{
$this->currentBundle = $this->assigner->loadBundle($bundle_name);
$settings = $this->currentBundle->getAssignmentSettings(self::METHOD_ID);
$this->setConfigTypeSelect($form, $settings['types']['config'], $this->t('exclude'));
$module_settings = $settings['module'];
$curated_settings = $settings['curated'];
$form['curated'] = array('#type' => 'checkbox', '#title' => $this->t('Exclude designated site-specific configuration'), '#default_value' => $curated_settings, '#description' => $this->t('Select this option to exclude from packaging items on a curated list of site-specific configuration.'));
$form['module'] = array('#type' => 'container', '#tree' => TRUE);
$form['module']['installed'] = array('#type' => 'checkbox', '#title' => $this->t('Exclude installed module-provided entity configuration'), '#default_value' => $module_settings['installed'], '#description' => $this->t('Select this option to exclude from packaging any configuration that is provided by already installed modules.'), '#attributes' => array('data-module-installed' => 'status'));
$show_if_module_installed_checked = array('visible' => array(':input[data-module-installed="status"]' => array('checked' => TRUE)));
$info = system_get_info('module', drupal_get_profile());
$form['module']['profile'] = array('#type' => 'checkbox', '#title' => $this->t("Don't exclude install profile's configuration"), '#default_value' => $module_settings['profile'], '#description' => $this->t("Select this option to not exclude from packaging any configuration that is provided by this site's install profile, %profile.", array('%profile' => $info['name'])), '#states' => $show_if_module_installed_checked);
$machine_name = $this->currentBundle->getMachineName();
$machine_name = !empty($machine_name) ? $machine_name : t('none');
$form['module']['namespace'] = array('#type' => 'checkbox', '#title' => $this->t("Don't exclude non-installed configuration by namespace"), '#default_value' => $module_settings['namespace'], '#description' => $this->t("Select this option to not exclude from packaging any configuration that is provided by non-installed modules with the package namespace (currently %namespace).", array('%namespace' => $machine_name)), '#states' => $show_if_module_installed_checked, '#attributes' => array('data-namespace' => 'status'));
$show_if_namespace_checked = array('visible' => array(':input[data-namespace="status"]' => array('checked' => TRUE), ':input[data-module-installed="status"]' => array('checked' => TRUE)));
$form['module']['namespace_any'] = array('#type' => 'checkbox', '#title' => $this->t("Don't exclude ANY configuration by namespace"), '#default_value' => $module_settings['namespace_any'], '#description' => $this->t("Select this option to not exclude from packaging any configuration that is provided by ANY modules with the package namespace (currently %namespace).\n Warning: Can cause installed configuration to be reassigned to different packages.", array('%namespace' => $machine_name)), '#states' => $show_if_namespace_checked);
$this->setActions($form);
return $form;
}
示例12: getValueOptions
public function getValueOptions()
{
if (!isset($this->value_options)) {
$module_info = system_get_info('module');
// Get a list of all the modules implementing a hook_permission() and sort by
// display name.
$modules = array();
foreach ($this->moduleHandler->getImplementations('permission') as $module) {
$modules[$module] = $module_info[$module]['name'];
}
asort($modules);
$this->value_options = array();
foreach ($modules as $module => $display_name) {
if ($permissions = $this->moduleHandler->invoke($module, 'permission')) {
foreach ($permissions as $perm => $perm_item) {
$this->value_options[$display_name][$perm] = String::checkPlain(strip_tags($perm_item['title']));
}
}
}
} else {
return $this->value_options;
}
}
示例13: getClientInformation
/**
* Implements Mollom::getClientInformation().
*/
public function getClientInformation()
{
// Retrieve Drupal distribution and installation profile information.
$profile = drupal_get_profile();
$profile_info = system_get_info('module', $profile) + array('distribution_name' => 'Drupal', 'version' => \Drupal::VERSION);
// Retrieve Mollom module information.
$mollom_info = system_get_info('module', 'mollom');
if (empty($mollom_info['version'])) {
// Manually build a module version string for repository checkouts.
$mollom_info['version'] = \Drupal::CORE_COMPATIBILITY . '-1.x-dev';
}
$data = array('platformName' => $profile_info['distribution_name'], 'platformVersion' => $profile_info['version'], 'clientName' => $mollom_info['name'], 'clientVersion' => $mollom_info['version']);
return $data;
}
示例14: getName
/**
* {@inheritdoc}
*/
public function getName($module)
{
$info = system_get_info('module', $module);
return isset($info['name']) ? $info['name'] : $module;
}
示例15: get_vals_version
/**
* Returns the module version as defined in the .info file for this module
* @return unknown
*/
function get_vals_version()
{
$info_data = system_get_info('module', 'vals_soc');
return $info_data['version'];
}