Commit 4bba7e7a authored by RajabNatshah's avatar RajabNatshah

Issue #3066186: Fix Drupal coding standard and practice

parent 663fc013
......@@ -33,4 +33,5 @@ Languages, and translation support.
Provide webforms features and settings.
### Varbase Updates Helper
Provides a UI to review Varbase Updates that are made available in every version.
\ No newline at end of file
Provides a UI to review Varbase Updates that are made available in every
version.
ignored_config_entities:
- 'webform.webform.*'
- 'xmlsitemap.xmlsitemap.*'
- 'varbase_core.general_settings.*'
\ No newline at end of file
- 'varbase_core.general_settings.*'
......@@ -4,4 +4,3 @@ __global_conditions:
__global_actions:
install_modules:
- length_indicator
......@@ -4,4 +4,3 @@ __global_conditions:
__global_actions:
install_modules:
- admin_toolbar_links_access_filter
......@@ -10384,4 +10384,4 @@ core.entity_view_display.media.video.small:
content:
field_media_cover_image:
settings:
image_link: ''
\ No newline at end of file
image_link: ''
......@@ -21,4 +21,4 @@ swiftmailer.message:
change:
convert_mode: false
format: text/plain
respect_format: true
\ No newline at end of file
respect_format: true
......@@ -21,4 +21,4 @@ core.entity_form_display.node.landing_page.default:
tolerance: 10
maxlength:
maxlength_js: null
maxlength_js_label: 'Content limited to @limit characters, remaining: <strong>@remaining</strong>'
\ No newline at end of file
maxlength_js_label: 'Content limited to @limit characters, remaining: <strong>@remaining</strong>'
__global_conditions:
expected_modules:
- varbase_media
\ No newline at end of file
- varbase_media
......@@ -6,7 +6,6 @@
*/
use Symfony\Component\Yaml\Yaml;
use Drupal\Core\Config;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Config\FileStorage;
......@@ -24,8 +23,8 @@ function varbase_admin_install() {
$module_path = Drupal::service('module_handler')->getModule($module_name)->getPath();
// Processer for install: in [$module_name].info.yml file.
// ---------------------------------------------------------------------------
$module_info_file = $module_path . '/'. $module_name . '.info.yml';
// ---------------------------------------------------------------------------.
$module_info_file = $module_path . '/' . $module_name . '.info.yml';
if (file_exists($module_info_file)) {
$module_info_data = (array) Yaml::parse(file_get_contents($module_info_file));
if (isset($module_info_data['install'])
......@@ -67,7 +66,6 @@ function varbase_admin_install() {
}
}
// ---------------------------------------------------------------------------
// Assign user 1 the "administrator" role.
$user = User::load(1);
$user->roles[] = 'administrator';
......@@ -80,44 +78,44 @@ function varbase_admin_install() {
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['access shortcuts']);
// Populate the default shortcut set.
$shortcut = Shortcut::create(array(
$shortcut = Shortcut::create([
'shortcut_set' => 'default',
'title' => t('Add content'),
'weight' => 0,
'link' => array('uri' => 'internal:/node/add'),
));
'link' => ['uri' => 'internal:/node/add'],
]);
$shortcut->save();
$shortcut = Shortcut::create(array(
$shortcut = Shortcut::create([
'shortcut_set' => 'default',
'title' => t('All content'),
'weight' => 1,
'link' => array('uri' => 'internal:/admin/content'),
));
'link' => ['uri' => 'internal:/admin/content'],
]);
$shortcut->save();
$shortcut = Shortcut::create(array(
$shortcut = Shortcut::create([
'shortcut_set' => 'default',
'title' => t('All media'),
'weight' => 2,
'link' => array('uri' => 'internal:/admin/content/media'),
));
'link' => ['uri' => 'internal:/admin/content/media'],
]);
$shortcut->save();
$shortcut = Shortcut::create(array(
$shortcut = Shortcut::create([
'shortcut_set' => 'default',
'title' => t('Taxonomy'),
'weight' => 3,
'link' => array('uri' => 'internal:/admin/structure/taxonomy'),
));
'link' => ['uri' => 'internal:/admin/structure/taxonomy'],
]);
$shortcut->save();
$shortcut = Shortcut::create(array(
$shortcut = Shortcut::create([
'shortcut_set' => 'default',
'title' => t('Permissions'),
'weight' => 4,
'link' => array('uri' => 'internal:/admin/people/permissions'),
));
'link' => ['uri' => 'internal:/admin/people/permissions'],
]);
$shortcut->save();
// Enable the admin theme.
......@@ -160,7 +158,7 @@ function varbase_admin_update_8602() {
}
/**
* Enable Admin Toolbar Links Access Filter module.
* Enable Admin Toolbar Links Access Filter module.
*/
function varbase_admin_update_8603() {
if (!\Drupal::moduleHandler()->moduleExists('admin_toolbar_links_access_filter')) {
......
......@@ -6,7 +6,6 @@
*/
use Symfony\Component\Yaml\Yaml;
use Drupal\Core\Config;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Config\FileStorage;
......@@ -21,8 +20,8 @@ function varbase_default_content_install() {
$module_path = Drupal::service('module_handler')->getModule($module_name)->getPath();
// Processer for install: in [$module_name].info.yml file.
// ---------------------------------------------------------------------------
$module_info_file = $module_path . '/'. $module_name . '.info.yml';
// ---------------------------------------------------------------------------.
$module_info_file = $module_path . '/' . $module_name . '.info.yml';
if (file_exists($module_info_file)) {
$module_info_data = (array) Yaml::parse(file_get_contents($module_info_file));
if (isset($module_info_data['install'])
......@@ -64,7 +63,6 @@ function varbase_default_content_install() {
}
}
// ---------------------------------------------------------------------------
// Entity updates to clear up any mismatched entity and/or field definitions
// And Fix changes were detected in the entity type and field definitions.
\Drupal::classResolver()
......
......@@ -6,7 +6,6 @@
*/
use Symfony\Component\Yaml\Yaml;
use Drupal\Core\Config;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Config\FileStorage;
......@@ -21,8 +20,8 @@ function varbase_development_install() {
$module_path = Drupal::service('module_handler')->getModule($module_name)->getPath();
// Processer for install: in [$module_name].info.yml file.
// ---------------------------------------------------------------------------
$module_info_file = $module_path . '/'. $module_name . '.info.yml';
// --------------------------------------------------------------------------.
$module_info_file = $module_path . '/' . $module_name . '.info.yml';
if (file_exists($module_info_file)) {
$module_info_data = (array) Yaml::parse(file_get_contents($module_info_file));
if (isset($module_info_data['install'])
......@@ -63,8 +62,7 @@ function varbase_development_install() {
}
}
}
// ---------------------------------------------------------------------------
// --------------------------------------------------------------------------.
// Entity updates to clear up any mismatched entity and/or field definitions
// And Fix changes were detected in the entity type and field definitions.
\Drupal::classResolver()
......@@ -72,25 +70,3 @@ function varbase_development_install() {
->applyUpdates();
}
/**
* Implements hook_uninstall().
*/
//function varbase_development_uninstall() {
//
// $module_name = preg_replace('/_uninstall$/', '', __FUNCTION__);
// $module_path = Drupal::service('module_handler')->getModule($module_name)->getPath();
//
// // Processer for uninstall: in [$module_name].info.yml file.
// // ---------------------------------------------------------------------------
// $module_info_file = $module_path . '/'. $module_name . '.info.yml';
// if (file_exists($module_info_file)) {
// $module_info_data = (array) Yaml::parse(file_get_contents($module_info_file));
// if (isset($module_info_data['uninstall'])
// && is_array($module_info_data['uninstall'])) {
// \Drupal::service('module_installer')->uninstall($module_info_data['uninstall'], TRUE);
// }
// }
//
//}
......@@ -6,10 +6,6 @@
*/
use Symfony\Component\Yaml\Yaml;
use Drupal\Core\Config;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Config\FileStorage;
use Drupal\varbase\Entity\VarbaseEntityDefinitionUpdateManager;
/**
......@@ -21,8 +17,8 @@ function varbase_internationalization_install() {
$module_path = Drupal::service('module_handler')->getModule($module_name)->getPath();
// Processer for install: in [$module_name].info.yml file.
// ---------------------------------------------------------------------------
$module_info_file = $module_path . '/'. $module_name . '.info.yml';
// ---------------------------------------------------------------------------.
$module_info_file = $module_path . '/' . $module_name . '.info.yml';
if (file_exists($module_info_file)) {
$module_info_data = (array) Yaml::parse(file_get_contents($module_info_file));
if (isset($module_info_data['install'])
......@@ -31,7 +27,6 @@ function varbase_internationalization_install() {
}
}
// ---------------------------------------------------------------------------
// Entity updates to clear up any mismatched entity and/or field definitions
// And Fix changes were detected in the entity type and field definitions.
\Drupal::classResolver()
......@@ -41,8 +36,9 @@ function varbase_internationalization_install() {
}
/**
* Issue #3032661: Changed [Varbase Internationalization] not to use the
* [Localization client] module by disabling it for old sites and not to
* Issue #3032661: Changed [Varbase Internationalization] not to use.
*
* The [Localization client] module by disabling it for old sites and not to
* install it in new Varbase installations.
*/
function varbase_internationalization_update_86001() {
......
......@@ -6,7 +6,6 @@
*/
use Symfony\Component\Yaml\Yaml;
use Drupal\Core\Config;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Config\FileStorage;
......@@ -21,8 +20,8 @@ function varbase_page_install() {
$module_path = Drupal::service('module_handler')->getModule($module_name)->getPath();
// Processer for install: in [$module_name].info.yml file.
// ---------------------------------------------------------------------------
$module_info_file = $module_path . '/'. $module_name . '.info.yml';
// ---------------------------------------------------------------------------.
$module_info_file = $module_path . '/' . $module_name . '.info.yml';
if (file_exists($module_info_file)) {
$module_info_data = (array) Yaml::parse(file_get_contents($module_info_file));
if (isset($module_info_data['install'])
......@@ -42,7 +41,7 @@ function varbase_page_install() {
$config_installer->installOptionalConfig($storage, '');
// Have the .settings.yml configs into the active config.
$settings_config_files = file_scan_directory($optional_install_path, '/^.*(settings.yml)$/i');
$settings_config_files = file_scan_directory($optional_install_path, '/^.*(settings.yml)$/i');
if (isset($settings_config_files) && is_array($settings_config_files)) {
foreach ($settings_config_files as $settings_config_file) {
$settings_config_file_content = file_get_contents(DRUPAL_ROOT . '/' . $settings_config_file->uri);
......@@ -53,7 +52,6 @@ function varbase_page_install() {
}
}
// ---------------------------------------------------------------------------
// Entity updates to clear up any mismatched entity and/or field definitions
// And Fix changes were detected in the entity type and field definitions.
\Drupal::classResolver()
......
......@@ -52,4 +52,4 @@ content:
hidden:
field_last_password_reset: true
field_password_expiration: true
langcode: true
\ No newline at end of file
langcode: true
......@@ -6,7 +6,6 @@
*/
use Symfony\Component\Yaml\Yaml;
use Drupal\Core\Config;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Config\FileStorage;
......@@ -21,8 +20,8 @@ function varbase_security_install() {
$module_path = Drupal::service('module_handler')->getModule($module_name)->getPath();
// Processer for install: in [$module_name].info.yml file.
// ---------------------------------------------------------------------------
$module_info_file = $module_path . '/'. $module_name . '.info.yml';
// ---------------------------------------------------------------------------.
$module_info_file = $module_path . '/' . $module_name . '.info.yml';
if (file_exists($module_info_file)) {
$module_info_data = (array) Yaml::parse(file_get_contents($module_info_file));
if (isset($module_info_data['install'])
......@@ -64,7 +63,6 @@ function varbase_security_install() {
}
}
// ---------------------------------------------------------------------------
// Entity updates to clear up any mismatched entity and/or field definitions
// And Fix changes were detected in the entity type and field definitions.
\Drupal::classResolver()
......
......@@ -4,9 +4,6 @@
* @file
* Contains varbase_security.module.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\user\Entity\User;
/**
* Implements hook_form_FORM_ID_alter() for user_form().
......
......@@ -24,9 +24,9 @@
.joyride-tip-guide thead th.is-active {
background: #fff;
border-bottom: 1px solid #fff;
border-top: 1px solid #E6E4DF;
border-left: 1px solid #E6E4DF;
border-right: 1px solid #E6E4DF;
border-top: 1px solid #e6e4df;
border-left: 1px solid #e6e4df;
border-right: 1px solid #e6e4df;
}
.joyride-tip-guide th.is-active > a,
.joyride-tip-guide th.is-active > a:hover {
......@@ -40,7 +40,7 @@
display: none;
}
.joyride-tip-guide thead > tr {
border-bottom: 1px solid #E6E4DF;
border-bottom: 1px solid #e6e4df;
}
.joyride-tip-guide .is-collapse-enabled .tabs:before,
.joyride-tip-guide .is-horizontal .tabs:before {
......@@ -49,13 +49,13 @@
.joyride-tip-guide .button {
border-radius: 0;
background-image: none;
background-color: #F9F9F9;
background-color: #f9f9f9;
text-shadow: none;
transition: all, 0.2s;
}
.joyride-tip-guide .button:hover,
.joyride-tip-guide .button:focus {
background-color: #FFFFFF;
background-color: #ffffff;
border-color: #008ee6;
background-image: none;
}
......@@ -84,7 +84,7 @@
outline: none;
}
.joyride-tip-guide .action-links .button--primary {
color: #327EBD;
color: #327ebd;
background: #fff;
font-size: 14px;
padding: 0.33rem 1.33rem;
......@@ -98,7 +98,7 @@
color: #fff;
box-shadow: none;
background-image: none;
background-color: #327EBD;
background-color: #327ebd;
}
.joyride-tip-guide .action-links .button--primary:focus {
border-color: #08639b;
......@@ -162,12 +162,12 @@
background-position: 5px 50%;
}
.joyride-tip-guide .messages--error {
border-color: #E32700;
border-color: #e32700;
}
.joyride-tip-guide .messages--warning {
border-color: #E29700;
border-color: #e29700;
}
.joyride-tip-guide .messages--status {
border-color: #73B355;
border-color: #73b355;
}
/*# sourceMappingURL=tour.admin.theme.css.map */
\ No newline at end of file
/*# sourceMappingURL=tour.admin.theme.css.map */
......@@ -52,7 +52,7 @@
}
.joyride-tip-guide .button:focus {
z-index: 10;
border: 1px solid #3AB2FF;
border: 1px solid #3ab2ff;
box-shadow: 0 0 0.5em 0.1em rgba(51, 177, 255, 0.7);
}
.joyride-tip-guide .button:active {
......@@ -83,7 +83,7 @@
color: #fff;
}
.joyride-tip-guide .button--primary:focus {
border: 1px solid #1280DF;
border: 1px solid #1280df;
}
.joyride-tip-guide .button--primary:hover {
box-shadow: 0 1px 2px rgba(23, 26, 28, 0.25);
......@@ -109,4 +109,4 @@
left: 28px;
right: auto;
}
/*# sourceMappingURL=tour.default.theme.css.map */
\ No newline at end of file
/*# sourceMappingURL=tour.default.theme.css.map */
<?php
/**
* @file
* Contains \Drupal\varbase_tour\Controller\VarbaseTourController.
*/
namespace Drupal\varbase_tour\Controller;
use Drupal\Core\Controller\ControllerBase;
/**
* Varbase Tour Controller.
*/
class VarbaseTourController extends ControllerBase {
/**
* Tour content.
*/
public function content() {
return [
'#theme' => 'varbase_welcome_theme',
'#welcome_modal_content' => $this->t('Welcome modal content'),
];
}
}
\ No newline at end of file
}
......@@ -6,7 +6,6 @@
*/
use Symfony\Component\Yaml\Yaml;
use Drupal\Core\Config;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Config\FileStorage;
......@@ -21,8 +20,8 @@ function varbase_tour_install() {
$module_path = Drupal::service('module_handler')->getModule($module_name)->getPath();
// Processer for install: in [$module_name].info.yml file.
// ---------------------------------------------------------------------------
$module_info_file = $module_path . '/'. $module_name . '.info.yml';
// ---------------------------------------------------------------------------.
$module_info_file = $module_path . '/' . $module_name . '.info.yml';
if (file_exists($module_info_file)) {
$module_info_data = (array) Yaml::parse(file_get_contents($module_info_file));
if (isset($module_info_data['install'])
......@@ -53,7 +52,7 @@ function varbase_tour_install() {
$config_installer->installOptionalConfig($storage, '');
// Have the .settings.yml configs into the active config.
$settings_config_files = file_scan_directory($optional_install_path, '/^.*(settings.yml)$/i');
$settings_config_files = file_scan_directory($optional_install_path, '/^.*(settings.yml)$/i');
if (isset($settings_config_files) && is_array($settings_config_files)) {
foreach ($settings_config_files as $settings_config_file) {
$settings_config_file_content = file_get_contents(DRUPAL_ROOT . '/' . $settings_config_file->uri);
......@@ -64,7 +63,6 @@ function varbase_tour_install() {
}
}
// ---------------------------------------------------------------------------
// Entity updates to clear up any mismatched entity and/or field definitions
// And Fix changes were detected in the entity type and field definitions.
\Drupal::classResolver()
......
......@@ -17,8 +17,8 @@ function varbase_tour_page_attachments(array &$page) {
// Then attach the seven tour styling library.
// And attach the varbase tour default theme library.
$page['#attached']['library'][] = 'seven/tour-styling';
// $page['#attached']['library'][] = 'varbase_tour/admin-theme';
$page['#attached']['library'][] = 'varbase_tour/default-theme';
// $page['#attached']['library'][] = 'varbase_tour/admin-theme';
$page['#attached']['library'][] = 'varbase_tour/default-theme';
}
// When the current page is the front page.
......@@ -27,12 +27,13 @@ function varbase_tour_page_attachments(array &$page) {
if (isset($query_welcome)) {
$varbase_tour_config = \Drupal::service('config.factory')->getEditable('varbase_core.general_settings');
$welcome_status = $varbase_tour_config->get('welcome_status');
// When we do have "/?tour=1&welcome=done" is in the URL address for the front page.
// When we do have "/?tour=1&welcome=done" is in the URL address.
// for the front page.
if ($query_welcome == 'done'
&& isset($welcome_status)
&& $welcome_status == 1) {
// Then update the "welcome status" checkbox config to unchecked.
// Then update the "welcome status" checkbox config to unchecked.
$varbase_tour_config->set('welcome_status', 0);
$varbase_tour_config->save();
}
......@@ -58,14 +59,14 @@ function varbase_tour_theme($existing, $type, $theme, $path) {
* Implements hook_page_top().
*/
function varbase_tour_page_top(array &$page_top) {
// Given that the current user is a logged in user.
// Given that the current user is a logged in user.
if (\Drupal::currentUser()->isAuthenticated()) {
// And the current page is the front page.
if (\Drupal::service('path.matcher')->isFrontPage()) {
$query_welcome = \Drupal::request()->query->get('welcome');
if (isset($query_welcome)) {
$varbase_tour_config = \Drupal::service('config.factory')->getEditable('varbase_core.general_settings');
$varbase_tour_config = \Drupal::service('config.factory')->getEditable('varbase_core.general_settings');
// When we do have "/?welcome" is in the URL address for the front page.
if ($query_welcome != 'done') {
// And the "welcome status" checkbox config is checked.
......
......@@ -2,4 +2,4 @@ services:
varbase_update_helper.commands:
class: Drupal\varbase_update_helper\Commands\VarbaseUpdateHelperCommands
tags:
- { name: drush.command }
\ No newline at end of file
- { name: drush.command }
......@@ -7,16 +7,16 @@ use Drupal\varbase_core\Utility\CommandHelper;
use Psr\Log\LoggerInterface;
/**
* Class VarbaseUpdateHelperCommands
* Class VarbaseUpdateHelperCommands.
*
* define drush commands for varbase_update_helper module
* Define drush commands for varbase_update_helper module.
*
* @package Drupal\varbase_update_helper\Commands
*/
class VarbaseUpdateHelperCommands extends DrushCommands {
/**
* command helper object (inspired by search API module)
* Command helper object (inspired by search API module)
*
* @var \Drupal\varbase_core\Utility\CommandHelper
*/
......@@ -38,19 +38,25 @@ class VarbaseUpdateHelperCommands extends DrushCommands {
}
/**
* applying an (optional) update hook (function) from module install file
* Applying an (optional) update hook (function) from module install file.
*
* Apply Varbase updates by invoking the related update hooks.
*
* @param string $module
* Module name.
* @param string $update_hook
* Update hook.
* @param array $options
* Options.
*
* @option force
*
* @command varbase_update_helper:varbase-apply-update
* @aliases varbase-up
*/
public function varbase_apply_update ($module = '', $update_hook = '', $options = ['force' => FALSE]) {
public function varbaseApplyUpdate($module = '', $update_hook = '', array $options = ['force' => FALSE]) {
$force = $options['force'];
$this->commandHelper->varbase_apply_update($module, $update_hook, $force);
$this->commandHelper->varbaseApplyUpdate($module, $update_hook, $force);
}
}
\ No newline at end of file
}
......@@ -23,4 +23,5 @@ class RouteSubscriber extends RouteSubscriberBase {
$route->setRequirement('_access', 'FALSE');
}
}
}
......@@ -130,4 +130,4 @@
<p class="messages messages--warning">This update failed to be done automatically.<br />
<span class="icon-help">Try running <code>drush varbase-up --force varbase_core varbase_core_update_8610</code> to force applying this update.</span>
This will likely override your previous configuration! Do this on your own risk.<p><br />
'
\ No newline at end of file
'
......@@ -38,7 +38,7 @@ function varbase_update_helper_drush_command() {