• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP system_get_info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中system_get_info函数的典型用法代码示例。如果您正苦于以下问题:PHP system_get_info函数的具体用法?PHP system_get_info怎么用?PHP system_get_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了system_get_info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:33,代码来源:AdminController.php


示例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'] : [];
 }
开发者ID:hugronaphor,项目名称:cornel,代码行数:12,代码来源:Extension.php


示例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;
  }
开发者ID:jeetendrasingh,项目名称:manage_profile,代码行数:62,代码来源:AssignmentExcludeForm.php


示例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'] : [];
 }
开发者ID:eloiv,项目名称:botafoc.cat,代码行数:14,代码来源:Extension.php


示例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']);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:14,代码来源:UserData.php


示例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;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:23,代码来源:BlockManager.php


示例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;
     }
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:14,代码来源:Permissions.php


示例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.'));
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:15,代码来源:Permission.php


示例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.'));
 }
开发者ID:pedrocones,项目名称:hydrotools,代码行数:19,代码来源:CurrentUserOrPermission.php


示例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);
             }
         }
     }
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:20,代码来源:RequiredTest.php


示例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;
 }
开发者ID:alexburrows,项目名称:cream-2.x,代码行数:24,代码来源:AssignmentExcludeForm.php


示例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;
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:23,代码来源:Permissions.php


示例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;
 }
开发者ID:ABaldwinHunter,项目名称:durhamatletico-cms,代码行数:17,代码来源:DrupalClient.php


示例14: getName

 /**
  * {@inheritdoc}
  */
 public function getName($module)
 {
     $info = system_get_info('module', $module);
     return isset($info['name']) ? $info['name'] : $module;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:8,代码来源:ModuleHandler.php


示例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'];
}
开发者ID:edwinraycom,项目名称:vals-soc,代码行数:9,代码来源:helper_functions.php


示例16: testThemeInfoAlter

 /**
  * Tests that theme info can be altered by a module.
  *
  * @see module_test_system_info_alter()
  */
 function testThemeInfoAlter()
 {
     $name = 'seven';
     $this->container->get('state')->set('module_test.hook_system_info_alter', TRUE);
     $module_handler = $this->container->get('module_handler');
     $this->themeHandler()->enable(array($name));
     $themes = $this->themeHandler()->listInfo();
     $this->assertFalse(isset($themes[$name]->info['regions']['test_region']));
     $module_handler->install(array('module_test'), FALSE);
     $this->assertTrue($module_handler->moduleExists('module_test'));
     $themes = $this->themeHandler()->listInfo();
     $this->assertTrue(isset($themes[$name]->info['regions']['test_region']));
     // Legacy assertions.
     // @todo Remove once theme initialization/info has been modernized.
     // @see https://drupal.org/node/2228093
     $info = system_get_info('theme', $name);
     $this->assertTrue(isset($info['regions']['test_region']));
     $regions = system_region_list($name);
     $this->assertTrue(isset($regions['test_region']));
     $system_list = system_list('theme');
     $this->assertTrue(isset($system_list[$name]->info['regions']['test_region']));
     $module_handler->uninstall(array('module_test'));
     $this->assertFalse($module_handler->moduleExists('module_test'));
     $themes = $this->themeHandler()->listInfo();
     $this->assertFalse(isset($themes[$name]->info['regions']['test_region']));
     // Legacy assertions.
     // @todo Remove once theme initialization/info has been modernized.
     // @see https://drupal.org/node/2228093
     $info = system_get_info('theme', $name);
     $this->assertFalse(isset($info['regions']['test_region']));
     $regions = system_region_list($name);
     $this->assertFalse(isset($regions['test_region']));
     $system_list = system_list('theme');
     $this->assertFalse(isset($system_list[$name]->info['regions']['test_region']));
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:40,代码来源:ThemeHandlerTest.php


示例17: _carbon_variable_get

/**
 * Retrieves the value associated with the specified key from the current theme.
 * If the key is not found, the specified default value will be returned instead.
 *
 * @param <string> $key
 *   The name of the key.
 * @param <mixed> $default
 *   The default value, returned if the property key is not found in the current
 *   theme.
 * @return <mixed>
 *   The value associated with the specified key, or the default value.
 */
function _carbon_variable_get($key, $default) {
  global $theme;
  $themes_info =& drupal_static(__FUNCTION__);
  if (!isset($themes_info[$theme])) {
    $themes_info = system_get_info('theme');
  }

  $value = $themes_info[$theme];
  foreach (explode('/', $key) as $part) {
    if (!isset($value[$part])) {
      return $default;
    }
    $value = $value[$part];
  }
  return $value;
}
开发者ID:rtdean93,项目名称:tbytam,代码行数:28,代码来源:template.php


示例18: helpPage

 /**
  * Prints a page listing general help for a module.
  *
  * @param string $name
  *   A module name to display a help page for.
  *
  * @return array
  *   A render array as expected by drupal_render().
  *
  * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
  */
 public function helpPage($name)
 {
     $build = array();
     if ($this->moduleHandler()->implementsHook($name, 'help')) {
         $module_name = $this->moduleHandler()->getName($name);
         $build['#title'] = SafeMarkup::checkPlain($module_name);
         $temp = $this->moduleHandler()->invoke($name, 'help', array("help.page.{$name}", $this->routeMatch));
         if (empty($temp)) {
             $build['top']['#markup'] = $this->t('No help is available for module %module.', array('%module' => $module_name));
         } else {
             $build['top']['#markup'] = $temp;
         }
         // Only print list of administration pages if the module in question has
         // any such pages associated with it.
         $admin_tasks = system_get_module_admin_tasks($name, system_get_info('module', $name));
         if (!empty($admin_tasks)) {
             $links = array();
             foreach ($admin_tasks as $task) {
                 $link['url'] = $task['url'];
                 $link['title'] = $task['title'];
                 $links[] = $link;
             }
             $build['links'] = array('#theme' => 'links__help', '#heading' => array('level' => 'h3', 'text' => $this->t('@module administration pages', array('@module' => $module_name))), '#links' => $links);
         }
         return $build;
     } else {
         throw new NotFoundHttpException();
     }
 }
开发者ID:scratch,项目名称:gai,代码行数:40,代码来源:HelpController.php


示例19: omega_form_system_theme_settings_alter

/**
 * Implements hook_form_FORM_alter().
 */
function omega_form_system_theme_settings_alter(&$form, &$form_state, $form_id = NULL)
{
    // General "alters" use a form id. Settings should not be set here. The only
    // thing useful about this is if you need to alter the form for the running
    // theme and *not* the the me setting. @see http://drupal.org/node/943212
    if (isset($form_id)) {
        return;
    }
    if (variable_get('theme_' . $GLOBALS['theme_key'] . '_settings')) {
        // Alert the user that the theme settings are served from a variable.
        drupal_set_message(t('The settings for this theme are currently served from a variable. You might want to export them to your .info file.'), 'warning', FALSE);
    }
    $form['omega_enable_warning'] = array('#type' => 'checkbox', '#title' => t('Show a warning if Omega is used directly'), '#description' => t('You can disable this warning message permanently, however, please be aware that Omega is a base theme and should not be used directly. You should always create a sub-theme instead.'), '#default_value' => omega_theme_get_setting('omega_enable_warning', TRUE), '#weight' => -20, '#access' => $GLOBALS['theme_key'] === 'omega');
    // Include the template.php and theme-settings.php files for all the themes in
    // the theme trail.
    foreach (omega_theme_trail() as $theme => $name) {
        $path = drupal_get_path('theme', $theme);
        $filename = DRUPAL_ROOT . '/' . $path . '/template.php';
        if (file_exists($filename)) {
            require_once $filename;
        }
        $filename = DRUPAL_ROOT . '/' . $path . '/theme-settings.php';
        if (file_exists($filename)) {
            require_once $filename;
        }
    }
    // Get the admin theme so we can set a class for styling this form.
    $admin = drupal_html_class(variable_get('admin_theme', $GLOBALS['theme']));
    $form['#prefix'] = '<div class="admin-theme-' . $admin . '">';
    $form['#suffix'] = '</div>';
    // Add some custom styling and functionality to our theme settings form.
    $form['#attached']['css'][] = drupal_get_path('theme', 'omega') . '/css/omega.admin.css';
    $form['#attached']['js'][] = drupal_get_path('theme', 'omega') . '/js/omega.admin.min.js';
    // Collapse all the core theme settings tabs in order to have the form actions
    // visible all the time without having to scroll.
    foreach (element_children($form) as $key) {
        if ($form[$key]['#type'] == 'fieldset') {
            $form[$key]['#collapsible'] = TRUE;
            $form[$key]['#collapsed'] = TRUE;
        }
    }
    if ($extensions = omega_extensions(NULL, TRUE)) {
        $form['omega'] = array('#type' => 'vertical_tabs', '#weight' => -10);
        // Load the theme settings for all enabled extensions.
        foreach ($extensions as $extension => $info) {
            $form['omega'][$extension] = array('#type' => 'fieldset', '#title' => $info['info']['name'], '#attributes' => array('class' => array('omega-extension')));
            $errors = array();
            if (!empty($info['info']['dependencies'])) {
                foreach ($info['info']['dependencies'] as $dependency) {
                    $dependency = drupal_parse_dependency($dependency);
                    // Check if the module exists.
                    if (!($module = system_get_info('module', $dependency['name']))) {
                        $errors[] = t('This extension requires the @module module.', array('@module' => ucwords(str_replace('_', ' ', $dependency['name']))));
                    } elseif (($version = omega_check_incompatibility($dependency, $module['version'])) !== NULL) {
                        $errors[] = t('This extension requires @module @version. The currently installed version is @installed.', array('@module' => $module['name'], '@version' => $version, '@installed' => !empty($module['version']) ? $module['version'] : t('undetermined')));
                    }
                }
                if (!empty($errors)) {
                    $form['omega'][$extension]['errors'] = array('#type' => 'item', '#title' => t('Missing requirements'), '#markup' => '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>', '#weight' => -20, '#name' => 'omega-requirements');
                }
            }
            // Disable all options if there were any errors.
            $form['omega'][$extension]['#disabled'] = !empty($errors) || variable_get('omega_toggle_extension_' . $extension) !== NULL;
            $form['omega'][$extension]['omega_toggle_extension_' . $extension] = array('#type' => 'checkbox', '#title' => t('Enable @extension extension', array('@extension' => $info['info']['name'])) . (variable_get('omega_toggle_extension_' . $extension) !== NULL ? ' <span class="marker">(' . t('overridden') . ')</span>' : ''), '#description' => t('This setting can be overridden with an equally named variable (@name) so you can control it on a per-environment basis by setting it in your settings.php file.', array('@name' => 'omega_toggle_extension_' . $extension)), '#default_value' => omega_extension_enabled($extension), '#weight' => -10);
            $element = array();
            // Load the implementation for this extensions and invoke the according
            // hook.
            $file = $info['path'] . '/' . $extension . '.settings.inc';
            if (is_file($file)) {
                require_once $file;
            }
            $function = $info['theme'] . '_extension_' . $extension . '_settings_form';
            if (function_exists($function)) {
                // By default, each extension resides in a vertical tab.
                $element = $function($element, $form, $form_state) + array('#type' => 'fieldset', '#title' => t('@extension extension configuration', array('@extension' => $info['info']['name'])), '#description' => $info['info']['description'], '#attributes' => array('class' => array('omega-extension-settings')), '#states' => array('disabled' => array('input[name="omega_toggle_extension_' . $extension . '"]' => array('checked' => FALSE))));
            }
            drupal_alter('extension_' . $extension . '_settings_form', $element, $form, $form_state);
            if (element_children($element)) {
                // Append the extension form to the theme settings form if it has any
                // children.
                $form['omega'][$extension]['settings'] = $element;
            }
        }
    }
    // Custom option for toggling the main content blog on the front page.
    $form['theme_settings']['omega_toggle_front_page_content'] = array('#type' => 'checkbox', '#title' => t('Front page content'), '#description' => t('Allow the main content block to be rendered on the front page.'), '#default_value' => omega_theme_get_setting('omega_toggle_front_page_content', TRUE));
    // We need a custom form submit handler for processing some of the values.
    $form['#submit'][] = 'omega_theme_settings_form_submit';
    // Store the extensions in an array so we can loop over them in the submit
    // callback.
    $form_state['extensions'] = array_keys($extensions);
}
开发者ID:joshirohit100,项目名称:dcd2,代码行数:95,代码来源:theme-settings.php


示例20: submitForm

 /**
  * {@inheritdoc}
  *
  * Sets the admin configs for each field.
  *
  * @param array &$form The brafton config form.
  * @param object $form_state the FormStateInterface object containing current state of form.
  *
  * @return method parent::submitForm Submits the form.
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $config = $this->config('brafton_importer.settings');
     // Permanently save the CTA images
     $file_value = $form_state->getValue('brafton_video_end_cta_button_image');
     if ($file_value) {
         $file = file_load($file_value[0]);
         $file_usage = \Drupal::service('file.usage');
         $file_usage->add($file, 'brafton_importer', 'node', $file->id());
         $config->set('brafton_importer.brafton_video_end_cta_button_image_url', $file->getFileUri());
     }
     $file_value = $form_state->getValue('brafton_video_end_cta_background');
     if ($file_value) {
         $file = file_load($file_value[0]);
         $file_usage = \Drupal::service('file.usage');
         $file_usage->add($file, 'brafton_importer', 'node', $file->id());
         $config->set('brafton_importer.brafton_video_end_cta_background_url', $file->getFileUri());
     }
     foreach ($form['brafton_general_options'] as $field => $field_value) {
         $config->set('brafton_importer.' . $field, $form_state->getValue($field));
     }
     foreach ($form['brafton_article_options'] as $field => $field_value) {
         $config->set('brafton_importer.' . $field, $form_state->getValue($field));
     }
     foreach ($form['brafton_video_options'] as $field => $field_value) {
         $config->set('brafton_importer.' . $field, $form_state->getValue($field));
     }
     foreach ($form['brafton_cta_options'] as $field => $field_value) {
         $config->set('brafton_importer.' . $field, $form_state->getValue($field));
     }
     foreach ($form['brafton_error_options'] as $field => $field_value) {
         $config->set('brafton_importer.' . $field, $form_state->getValue($field));
     }
     $config->save();
     $module_info = system_get_info('module', 'brafton_importer');
     debug($module_info);
     return parent::submitForm($form, $form_state);
 }
开发者ID:ContentLEAD,项目名称:BraftonDrupal8Module,代码行数:48,代码来源:BraftonForm.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP system_hosts_generate函数代码示例发布时间:2022-05-23
下一篇:
PHP system_error函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap