本文整理汇总了PHP中conf_path函数的典型用法代码示例。如果您正苦于以下问题:PHP conf_path函数的具体用法?PHP conf_path怎么用?PHP conf_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了conf_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDrupalRewriteSettings
/**
* Tests the drupal_rewrite_settings() function.
*/
function testDrupalRewriteSettings()
{
include_once DRUPAL_ROOT . '/core/includes/install.inc';
$tests = array(array('original' => '$no_index_value_scalar = TRUE;', 'settings' => array('no_index_value_scalar' => (object) array('value' => FALSE, 'comment' => 'comment')), 'expected' => '$no_index_value_scalar = false; // comment'), array('original' => '$no_index_value_scalar = TRUE;', 'settings' => array('no_index_value_foo' => array('foo' => array('value' => (object) array('value' => NULL, 'required' => TRUE, 'comment' => 'comment')))), 'expected' => <<<'EXPECTED'
$no_index_value_scalar = TRUE;
$no_index_value_foo['foo']['value'] = NULL; // comment
EXPECTED
), array('original' => '$no_index_value_array = array("old" => "value");', 'settings' => array('no_index_value_array' => (object) array('value' => FALSE, 'required' => TRUE, 'comment' => 'comment')), 'expected' => '$no_index_value_array = array("old" => "value");
$no_index_value_array = false; // comment'), array('original' => '$has_index_value_scalar["foo"]["bar"] = NULL;', 'settings' => array('has_index_value_scalar' => array('foo' => array('bar' => (object) array('value' => FALSE, 'required' => TRUE, 'comment' => 'comment')))), 'expected' => '$has_index_value_scalar["foo"]["bar"] = false; // comment'), array('original' => '$has_index_value_scalar["foo"]["bar"] = "foo";', 'settings' => array('has_index_value_scalar' => array('foo' => array('value' => (object) array('value' => array('value' => 2), 'required' => TRUE, 'comment' => 'comment')))), 'expected' => <<<'EXPECTED'
$has_index_value_scalar["foo"]["bar"] = "foo";
$has_index_value_scalar['foo']['value'] = array (
'value' => 2,
); // comment
EXPECTED
));
foreach ($tests as $test) {
$filename = Settings::get('file_public_path', conf_path() . '/files') . '/mock_settings.php';
file_put_contents(DRUPAL_ROOT . '/' . $filename, "<?php\n" . $test['original'] . "\n");
drupal_rewrite_settings($test['settings'], $filename);
$this->assertEqual(file_get_contents(DRUPAL_ROOT . '/' . $filename), "<?php\n" . $test['expected'] . "\n");
}
// Test that <?php gets added to the start of an empty settings file.
// Set the array of settings that will be written to the file.
$test = array('settings' => array('no_index' => (object) array('value' => TRUE, 'required' => TRUE)), 'expected' => '$no_index = true;');
// Make an empty file.
$filename = Settings::get('file_public_path', conf_path() . '/files') . '/mock_settings.php';
file_put_contents(DRUPAL_ROOT . '/' . $filename, "");
// Write the setting to the file.
drupal_rewrite_settings($test['settings'], $filename);
// Check that the result is just the php opening tag and the settings.
$this->assertEqual(file_get_contents(DRUPAL_ROOT . '/' . $filename), "<?php\n" . $test['expected'] . "\n");
}
示例2: getKernelParameters
/**
* Returns the kernel parameters.
*
* @return array An array of kernel parameters
*/
protected function getKernelParameters()
{
$parameters = parent::getKernelParameters();
$parameters['kernel.drupal_root'] = DRUPAL_ROOT;
$parameters['kernel.conf_path'] = conf_path();
return $parameters;
}
示例3: testFileCheckLocalDirectoryHandling
/**
* Test local directory handling functions.
*/
function testFileCheckLocalDirectoryHandling()
{
$directory = conf_path() . '/files';
// Check a new recursively created local directory for correct file system
// permissions.
$parent = $this->randomMachineName();
$child = $this->randomMachineName();
// Files directory already exists.
$this->assertTrue(is_dir($directory), t('Files directory already exists.'), 'File');
// Make files directory writable only.
$old_mode = fileperms($directory);
// Create the directories.
$parent_path = $directory . DIRECTORY_SEPARATOR . $parent;
$child_path = $parent_path . DIRECTORY_SEPARATOR . $child;
$this->assertTrue(drupal_mkdir($child_path, 0775, TRUE), t('No error reported when creating new local directories.'), 'File');
// Ensure new directories also exist.
$this->assertTrue(is_dir($parent_path), t('New parent directory actually exists.'), 'File');
$this->assertTrue(is_dir($child_path), t('New child directory actually exists.'), 'File');
// Check that new directory permissions were set properly.
$this->assertDirectoryPermissions($parent_path, 0775);
$this->assertDirectoryPermissions($child_path, 0775);
// Check that existing directory permissions were not modified.
$this->assertDirectoryPermissions($directory, $old_mode);
// Check creating a directory using an absolute path.
$absolute_path = drupal_realpath($directory) . DIRECTORY_SEPARATOR . $this->randomMachineName() . DIRECTORY_SEPARATOR . $this->randomMachineName();
$this->assertTrue(drupal_mkdir($absolute_path, 0775, TRUE), 'No error reported when creating new absolute directories.', 'File');
$this->assertDirectoryPermissions($absolute_path, 0775);
}
示例4: urlToFileEntity
protected function urlToFileEntity($url)
{
$url = urldecode(DRUPAL_ROOT . EntityPathHelper::normalizeUrl($url));
if (file_exists($url)) {
// Get the filename.
$filename = pathinfo($url, PATHINFO_FILENAME) . '.' . pathinfo($url, PATHINFO_EXTENSION);
$filesize = filesize($url);
$files = db_select('file_managed', 'f')->fields('f', array('fid', 'uri', 'filesize'))->condition('filename', $filename)->condition('filesize', $filesize)->execute();
$found_fid = -1;
while ($row = $files->fetch()) {
$result_uri = drupal_realpath($row->uri);
if ($result_uri == drupal_realpath($url)) {
$found_fid = $row->fid;
break;
}
}
if ($found_fid !== -1) {
return Entity::load($found_fid, 'file');
} else {
// Create the file entity.
if ($contents = file_get_contents($url)) {
$public_files_directory = DRUPAL_ROOT . '/' . variable_get('file_public_path', conf_path() . '/files') . '/';
$schema_url = 'public://' . str_replace($public_files_directory, '', $url);
// This will basically re-create the same file with the same filename, so we don't
// need to check to see if the file already exists because we don't care to replace
// the file with itself.
$file = file_save_data($contents, $schema_url, FILE_EXISTS_REPLACE);
return Entity::load($file->fid, 'file');
}
}
}
return false;
}
示例5: add_species_hints
/**
* An extension control for dynamic forms that adds a box to output hints on any
* species selected for addition to the species checklist grid. To use this control
* provide a file called speciesHints.json in the Drupal file path, within the indicia
* subfolder. This should contain a JSON object with the property names matching the
* external keys of the taxa_taxon_list table, and the property values being the hint
* string to show.
*/
public static function add_species_hints($auth, $args, $tabalias, $options, $path)
{
// enable nice tooltips
//drupal_add_library('system', 'ui.tooltip', true);
$filePath = variable_get('file_public_path', conf_path() . '/files');
data_entry_helper::$javascript .= "initSpeciesHints('{$filePath}/indicia/speciesHints.json');\n";
return '<h3>' . lang::get('Hints relating to species names entered') . '</h3> ' . '<div id="species-hints"></div>';
}
示例6: __construct
/**
* do not change
*/
private function __construct()
{
$this->defaults = array('width' => '300px', 'height' => '200px', 'zoom' => 3, 'maxzoom' => 14, 'controltype' => 'Small', 'pancontrol' => 1, 'streetviewcontrol' => 0, 'align' => 'None', 'latlong' => '40,0', 'maptype' => 'Map', 'mtc' => 'standard', 'baselayers' => array('Map', 'Satellite', 'Hybrid'), 'styles' => array('line_default' => array('0000ff', 5, 45, '', 0, 0), 'poly_default' => array('000000', 3, 25, 'ff0000', 45), 'highlight_color' => 'ff0000'), 'line_colors' => array('#00cc00', '#ff0000', '#0000ff'));
$this->defaults['behavior'] = array();
// @todo refactor this for removal
$m = array();
// @todo convert to class GmapBehaviours or method addBehavior
$behaviors = gmap_module_invoke('behaviors', $m);
foreach ($behaviors as $k => $v) {
$this->defaults['behavior'][$k] = $v['default'];
}
$this->defaults = array_merge($this->defaults, variable_get('gmap_default', array()));
// former _gmap_base_js()
$this->basejs = array();
$path = drupal_get_path('module', 'gmap');
// Convert some language codes.
// For Google Maps API v3, the drupal language code is not always the same as the google language code.
// @see https://developers.google.com/maps/documentation/javascript/basics#Localization
global $language;
switch ($language->language) {
case 'zh-hans':
// 'Chinese, Simplified'
$langcode = 'zh-CN';
break;
case 'zh-hant':
// 'Chinese, Traditional'
$langcode = 'zh-TW';
break;
case 'he':
// Hebrew
$langcode = 'iw';
break;
case 'nb':
// 'Norwegian Bokm�l', 'Bokm�l'
// 'Norwegian Bokm�l', 'Bokm�l'
case 'nn':
// 'Norwegian Nynorsk', 'Nynorsk'
$langcode = 'no';
// 'Norwegian'
break;
default:
$langcode = $language->language;
break;
}
$m = array();
$query = array('v' => variable_get('gmap_api_version', GMAP_API_VERSION), 'language' => $langcode, 'sensor' => 'false', 'libraries' => implode(array_merge(variable_get('gmap_api_libraries', array()), gmap_module_invoke('libraries', $m)), ','));
if ($key = gmap_get_key()) {
$query['key'] = $key;
}
$this->basejs[$path . '/js/gmap.js'] = array('weight' => 1);
$this->basejs[$path . '/js/icon.js'] = array('weight' => 2);
$this->basejs[$path . '/js/marker.js'] = array('weight' => 2);
$this->basejs[$path . '/js/highlight.js'] = array('weight' => 2);
$this->basejs[$path . '/js/poly.js'] = array('weight' => 2);
$this->basejs[url(gmap_views_protocol() . '://maps.googleapis.com/maps/' . 'api/js', array('query' => $query))] = array('type' => 'external', 'weight' => 1);
$this->basejs[base_path() . variable_get('file_public_path', conf_path() . '/files') . '/js/gmap_markers.js'] = array('type' => 'external', 'weight' => 4);
}
示例7: testReadOnlyBehavior
/**
* Test read-only specific behavior.
*/
function testReadOnlyBehavior()
{
// Generate a test file
$filename = $this->randomMachineName();
$filepath = conf_path() . '/files/' . $filename;
file_put_contents($filepath, $filename);
// Generate a read-only stream wrapper instance
$uri = $this->scheme . '://' . $filename;
file_stream_wrapper_get_instance_by_scheme($this->scheme);
// Attempt to open a file in read/write mode
$handle = @fopen($uri, 'r+');
$this->assertFalse($handle, 'Unable to open a file for reading and writing with the read-only stream wrapper.');
// Attempt to open a file in binary read mode
$handle = fopen($uri, 'rb');
$this->assertTrue($handle, 'Able to open a file for reading in binary mode with the read-only stream wrapper.');
$this->assertTrue(fclose($handle), 'Able to close file opened in binary mode using the read_only stream wrapper.');
// Attempt to open a file in text read mode
$handle = fopen($uri, 'rt');
$this->assertTrue($handle, 'Able to open a file for reading in text mode with the read-only stream wrapper.');
$this->assertTrue(fclose($handle), 'Able to close file opened in text mode using the read_only stream wrapper.');
// Attempt to open a file in read mode
$handle = fopen($uri, 'r');
$this->assertTrue($handle, 'Able to open a file for reading with the read-only stream wrapper.');
// Attempt to change file permissions
$this->assertFalse(@chmod($uri, 0777), 'Unable to change file permissions when using read-only stream wrapper.');
// Attempt to acquire an exclusive lock for writing
$this->assertFalse(@flock($handle, LOCK_EX | LOCK_NB), 'Unable to acquire an exclusive lock using the read-only stream wrapper.');
// Attempt to obtain a shared lock
$this->assertTrue(flock($handle, LOCK_SH | LOCK_NB), 'Able to acquire a shared lock using the read-only stream wrapper.');
// Attempt to release a shared lock
$this->assertTrue(flock($handle, LOCK_UN | LOCK_NB), 'Able to release a shared lock using the read-only stream wrapper.');
// Attempt to truncate the file
$this->assertFalse(@ftruncate($handle, 0), 'Unable to truncate using the read-only stream wrapper.');
// Attempt to write to the file
$this->assertFalse(@fwrite($handle, $this->randomMachineName()), 'Unable to write to file using the read-only stream wrapper.');
// Attempt to flush output to the file
$this->assertFalse(@fflush($handle), 'Unable to flush output to file using the read-only stream wrapper.');
// Attempt to close the stream. (Suppress errors, as fclose triggers fflush.)
$this->assertTrue(fclose($handle), 'Able to close file using the read_only stream wrapper.');
// Test the rename() function
$this->assertFalse(@rename($uri, $this->scheme . '://newname.txt'), 'Unable to rename files using the read-only stream wrapper.');
// Test the unlink() function
$this->assertTrue(@drupal_unlink($uri), 'Able to unlink file using read-only stream wrapper.');
$this->assertTrue(file_exists($filepath), 'Unlink File was not actually deleted.');
// Test the mkdir() function by attempting to create a directory.
$dirname = $this->randomMachineName();
$dir = conf_path() . '/files/' . $dirname;
$readonlydir = $this->scheme . '://' . $dirname;
$this->assertFalse(@drupal_mkdir($readonlydir, 0775, 0), 'Unable to create directory with read-only stream wrapper.');
// Create a temporary directory for testing purposes
$this->assertTrue(drupal_mkdir($dir), 'Test directory created.');
// Test the rmdir() function by attempting to remove the directory.
$this->assertFalse(@drupal_rmdir($readonlydir), 'Unable to delete directory with read-only stream wrapper.');
// Remove the temporary directory.
drupal_rmdir($dir);
}
示例8: getStream
/**
* Returns the current stream used to import and export configurations.
* Default value is config://
*
* @return string
*/
public static function getStream()
{
$temp_stream = static::$stream;
// During the install process strema wrappers are to available so this is
// a work around.
if (!file_stream_wrapper_get_instance_by_uri($temp_stream)) {
$temp_stream = variable_get('configuration_config_path', conf_path() . '/files/config');
}
return $temp_stream;
}
示例9: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state)
{
$conf_path = './' . conf_path(FALSE);
$settings_file = $conf_path . '/settings.php';
$form['#title'] = $this->t('Database configuration');
$drivers = drupal_get_database_types();
$drivers_keys = array_keys($drivers);
// Unless there is input for this form (for a non-interactive installation,
// input originates from the $settings array passed into install_drupal()),
// check whether database connection settings have been prepared in
// settings.php already.
// Note: The installer even executes this form if there is a valid database
// connection already, since the submit handler of this form is responsible
// for writing all $settings to settings.php (not limited to $databases).
$input =& $form_state->getUserInput();
if (!isset($input['driver']) && ($database = Database::getConnectionInfo())) {
$input['driver'] = $database['default']['driver'];
$input[$database['default']['driver']] = $database['default'];
}
if (isset($input['driver'])) {
$default_driver = $input['driver'];
// In case of database connection info from settings.php, as well as for a
// programmed form submission (non-interactive installer), the table prefix
// information is usually normalized into an array already, but the form
// element only allows to configure one default prefix for all tables.
$prefix =& $input[$default_driver]['prefix'];
if (isset($prefix) && is_array($prefix)) {
$prefix = $prefix['default'];
}
$default_options = $input[$default_driver];
} else {
$default_driver = current($drivers_keys);
$default_options = array();
}
$form['driver'] = array('#type' => 'radios', '#title' => $this->t('Database type'), '#required' => TRUE, '#default_value' => $default_driver);
if (count($drivers) == 1) {
$form['driver']['#disabled'] = TRUE;
}
// Add driver specific configuration options.
foreach ($drivers as $key => $driver) {
$form['driver']['#options'][$key] = $driver->name();
$form['settings'][$key] = $driver->getFormOptions($default_options);
$form['settings'][$key]['#prefix'] = '<h2 class="js-hide">' . $this->t('@driver_name settings', array('@driver_name' => $driver->name())) . '</h2>';
$form['settings'][$key]['#type'] = 'container';
$form['settings'][$key]['#tree'] = TRUE;
$form['settings'][$key]['advanced_options']['#parents'] = array($key);
$form['settings'][$key]['#states'] = array('visible' => array(':input[name=driver]' => array('value' => $key)));
}
$form['actions'] = array('#type' => 'actions');
$form['actions']['save'] = array('#type' => 'submit', '#value' => $this->t('Save and continue'), '#button_type' => 'primary', '#limit_validation_errors' => array(array('driver'), array($default_driver)), '#submit' => array('::submitForm'));
$form['errors'] = array();
$form['settings_file'] = array('#type' => 'value', '#value' => $settings_file);
return $form;
}
示例10: calculateScore
/**
* Implements \SiteAudit\Check\Abstract\calculateScore().
*/
public function calculateScore()
{
$drupal_root = drush_get_context('DRUSH_SELECTED_DRUPAL_ROOT');
exec('du -s -k -x ' . $drupal_root . '/' . variable_get('file_public_path', conf_path() . '/files') . '/', $result);
$size_files_kb_exploded = explode("\t", trim($result[0]));
$this->registry['size_files_kb'] = $size_files_kb_exploded[0];
if (!$this->registry['size_files_kb']) {
$this->abort = TRUE;
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL;
}
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO;
}
示例11: getFormOptions
/**
* {@inheritdoc}
*/
public function getFormOptions(array $database)
{
$form = parent::getFormOptions($database);
// Remove the options that only apply to client/server style databases.
unset($form['username'], $form['password'], $form['advanced_options']['host'], $form['advanced_options']['port']);
// Make the text more accurate for SQLite.
$form['database']['#title'] = t('Database file');
$form['database']['#description'] = t('The absolute path to the file where @drupal data will be stored. This must be writable by the web server and should exist outside of the web root.', array('@drupal' => drupal_install_profile_distribution_name()));
$default_database = conf_path(FALSE) . '/files/.ht.sqlite';
$form['database']['#default_value'] = empty($database['database']) ? $default_database : $database['database'];
return $form;
}
示例12: check_permission
/**
* Checking permissions on files and folders.
*/
function check_permission()
{
$conf_dir = drupal_verify_install_file(conf_path(), FILE_NOT_WRITABLE, 'dir');
if (!$conf_dir) {
$data = '<li>' . t('The directory %file is not protected from modifications and poses a security risk. You must change the directory\'s permissions to be non-writable. ', array('%file' => conf_path())) . '</li>';
fwrite($GLOBALS['createdFile'], $data);
}
$conf_file = drupal_verify_install_file(conf_path() . '/settings.php', FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE);
if (!$conf_file) {
$data = '<li>' . t('The file %file is not protected from modifications and poses a security risk. You must change the file\'s permissions to be non-writable.', array('%file' => conf_path() . '/settings.php')) . '</li>';
fwrite($GLOBALS['createdFile'], $data);
}
}
示例13: backupDatabase
public static function backupDatabase()
{
self::$database_dump = self::directory_cache('db_dumps') . '/' . basename(conf_path()) . '-' . REQUEST_TIME . '.sql';
if (!file_exists(self::$database_dump)) {
$cmd = sprintf('%s sql-dump --uri=%s --root=%s --result-file=%s', UNISH_DRUSH, UPAL_WEB_URL, UPAL_ROOT, self::$database_dump);
exec($cmd, $output, $return);
if ($return) {
echo "Failed to create database backup.\n";
echo $output;
exit(1);
}
}
}
示例14: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state)
{
$form['#title'] = $this->t('Configure site');
// Warn about settings.php permissions risk
$settings_dir = conf_path();
$settings_file = $settings_dir . '/settings.php';
// Check that $_POST is empty so we only show this message when the form is
// first displayed, not on the next page after it is submitted. (We do not
// want to repeat it multiple times because it is a general warning that is
// not related to the rest of the installation process; it would also be
// especially out of place on the last page of the installer, where it would
// distract from the message that the Drupal installation has completed
// successfully.)
$post_params = $this->getRequest()->request->all();
if (empty($post_params) && (!drupal_verify_install_file(DRUPAL_ROOT . '/' . $settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE) || !drupal_verify_install_file(DRUPAL_ROOT . '/' . $settings_dir, FILE_NOT_WRITABLE, 'dir'))) {
drupal_set_message(t('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the <a href="@handbook_url">online handbook</a>.', array('%dir' => $settings_dir, '%file' => $settings_file, '@handbook_url' => 'http://drupal.org/server-permissions')), 'warning');
}
$form['#attached']['library'][] = 'system/drupal.system';
// Add JavaScript time zone detection.
$form['#attached']['library'][] = 'core/drupal.timezone';
// We add these strings as settings because JavaScript translation does not
// work during installation.
$js = array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail')));
$form['#attached']['js'][] = array('data' => $js, 'type' => 'setting');
// Cache a fully-built schema. This is necessary for any invocation of
// index.php because: (1) setting cache table entries requires schema
// information, (2) that occurs during bootstrap before any module are
// loaded, so (3) if there is no cached schema, drupal_get_schema() will
// try to generate one but with no loaded modules will return nothing.
//
// @todo Move this to the 'install_finished' task?
drupal_get_schema(NULL, TRUE);
$form['site_information'] = array('#type' => 'fieldgroup', '#title' => $this->t('Site information'));
$form['site_information']['site_name'] = array('#type' => 'textfield', '#title' => $this->t('Site name'), '#required' => TRUE, '#weight' => -20);
$form['site_information']['site_mail'] = array('#type' => 'email', '#title' => $this->t('Site email address'), '#default_value' => ini_get('sendmail_from'), '#description' => $this->t("Automated emails, such as registration information, will be sent from this address. Use an address ending in your site's domain to help prevent these emails from being flagged as spam."), '#required' => TRUE, '#weight' => -15);
$form['admin_account'] = array('#type' => 'fieldgroup', '#title' => $this->t('Site maintenance account'));
$form['admin_account']['account']['name'] = array('#type' => 'textfield', '#title' => $this->t('Username'), '#maxlength' => USERNAME_MAX_LENGTH, '#description' => $this->t('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.'), '#required' => TRUE, '#attributes' => array('class' => array('username')));
$form['admin_account']['account']['pass'] = array('#type' => 'password_confirm', '#required' => TRUE, '#size' => 25);
$form['admin_account']['account']['#tree'] = TRUE;
$form['admin_account']['account']['mail'] = array('#type' => 'email', '#title' => $this->t('Email address'), '#required' => TRUE);
$form['regional_settings'] = array('#type' => 'fieldgroup', '#title' => $this->t('Regional settings'));
$countries = $this->countryManager->getList();
$form['regional_settings']['site_default_country'] = array('#type' => 'select', '#title' => $this->t('Default country'), '#empty_value' => '', '#default_value' => $this->config('system.date')->get('country.default'), '#options' => $countries, '#description' => $this->t('Select the default country for the site.'), '#weight' => 0);
$form['regional_settings']['date_default_timezone'] = array('#type' => 'select', '#title' => $this->t('Default time zone'), '#default_value' => date_default_timezone_get(), '#options' => system_time_zones(), '#description' => $this->t('By default, dates in this site will be displayed in the chosen time zone.'), '#weight' => 5, '#attributes' => array('class' => array('timezone-detect')));
$form['update_notifications'] = array('#type' => 'fieldgroup', '#title' => $this->t('Update notifications'));
$form['update_notifications']['update_status_module'] = array('#type' => 'checkboxes', '#title' => $this->t('Update notifications'), '#options' => array(1 => $this->t('Check for updates automatically'), 2 => $this->t('Receive email notifications')), '#default_value' => array(1, 2), '#description' => $this->t('The system will notify you when updates and important security releases are available for installed components. Anonymous information about your site is sent to <a href="@drupal">Drupal.org</a>.', array('@drupal' => 'http://drupal.org')), '#weight' => 15);
$form['update_notifications']['update_status_module'][2] = array('#states' => array('visible' => array('input[name="update_status_module[1]"]' => array('checked' => TRUE))));
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Save and continue'), '#weight' => 15, '#button_type' => 'primary');
return $form;
}
示例15: __construct
/**
* @param string $connection
* Database connection name (key in $databases array from settings.php).
*/
public function __construct($connection)
{
if (!defined('DRUPAL_ROOT') || !function_exists('conf_path')) {
throw new \RuntimeException('Drupal is not bootstrapped.');
}
$databases = [];
require sprintf('%s/%s/settings.php', DRUPAL_ROOT, conf_path());
if (empty($databases[$connection])) {
throw new \InvalidArgumentException(sprintf('The "%s" database connection does not exist.', $connection));
}
$db = $databases[$connection]['default'];
$this->db = new Operator($db['username'], $db['password'], $db['host'], $db['port']);
$this->source = $db['database'];
$this->temporary = "tqextension_{$this->source}";
}