3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class generates form components for Site Url.
21 class CRM_Admin_Form_Setting_UF
extends CRM_Admin_Form_Setting
{
23 protected $_settings = [];
25 protected $_uf = NULL;
28 * Build the form object.
30 public function buildQuickForm() {
31 $config = CRM_Core_Config
::singleton();
32 $this->_uf
= $config->userFramework
;
33 $this->_settings
['syncCMSEmail'] = CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
;
35 if ($this->_uf
== 'WordPress') {
36 $this->_settings
['wpBasePage'] = CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
;
39 CRM_Utils_System
::setTitle(
40 ts('Settings - %1 Integration', [1 => $this->_uf
])
43 if ($config->userSystem
->is_drupal
) {
44 $this->_settings
['userFrameworkUsersTableName'] = CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
;
47 // find out if drupal has its database prefixed
50 if (isset($databases['default']['default']['prefix'])) {
51 if (is_array($databases['default']['default']['prefix'])) {
52 $drupal_prefix = $databases['default']['default']['prefix']['default'];
55 $drupal_prefix = $databases['default']['default']['prefix'];
59 if ($config->userSystem
->viewsExists() &&
61 $config->dsn
!= $config->userFrameworkDSN ||
!empty($drupal_prefix)
64 $dsnArray = DB
::parseDSN($config->dsn
);
65 $tableNames = CRM_Core_DAO
::getTableNames();
67 $tablePrefixes = '$databases[\'default\'][\'default\'][\'prefix\']= array(';
68 if ($config->userFramework
=== 'Backdrop') {
69 $tablePrefixes = '$database_prefix = array(';
71 // add default prefix: the drupal database prefix
72 $tablePrefixes .= "\n 'default' => '$drupal_prefix',";
74 if ($config->dsn
!= $config->userFrameworkDSN
) {
75 $prefix = "`{$dsnArray['database']}`.";
77 foreach ($tableNames as $tableName) {
78 $tablePrefixes .= "\n '" . str_pad($tableName . "'", 41) . " => '{$prefix}',";
80 $tablePrefixes .= "\n);";
81 $this->assign('tablePrefixes', $tablePrefixes);
84 parent
::buildQuickForm();