-
' . DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('slide_title_' . $i), fn() => theme_get_setting('slide_title_' . $i)) . '
+ '.DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('slide_title_' . $i), fn() => theme_get_setting('slide_title_' . $i)).'
-
' . DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('slide_desc_' . $i), fn() => theme_get_setting('slide_desc_' . $i))['value'] . '
+
'.DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('slide_desc_' . $i), fn() => theme_get_setting('slide_desc_' . $i))['value'].'
@@ -101,17 +110,17 @@
/**
* Preprocess variables for the menu local task template.
- *
* @param $variables
*/
function market_wave_preprocess_menu_local_task(&$variables) {
$variables['link']['#title'] = $variables['element']['#link']['title'];
$variables['link']['#options']['attributes']['class'][] = 'nav-link';
if (!empty($variables['element']['#active'])) {
- $variables['link']['#options']['attributes']['class'][] = 'active';
+ $variables['link']['#options']['attributes']['class'][] = 'active';
}
}
+
/**
* Form_alter()
*/
@@ -146,6 +155,7 @@
'#attributes' => ['class' => ['more-links']],
];
+
// Forgot password link.
$form['more-links']['forgot_password_link'] = [
'#type' => 'link',
@@ -184,23 +194,22 @@
#[LegacyHook]
-function market_wave_preprocess_comment(&$variables) {
- \Drupal::service(MarketWaveHooks::class)->preprocessComment($variables);
+function market_wave_preprocess_comment(&$variables)
+{
+ \Drupal::service(MarketWaveHooks::class)->preprocessComment($variables);
}
-
-/**
- *
- */
function comment_form_alter(&$form, &$form_state, $form_id) {
- if ($form_id == 'comment_comment_form') {
+ if ($form_id == 'comment_comment_form'){
$form['subject']['widget'][0]['value']['#placeholder'] = "Subject";
$form['comment_body']['widget'][0]['#placeholder'] = "Comment";
$form['actions']['submit']['#value'] = "Post Comment";
}
}
+
/**
* Implements hook_preprocess_HOOK() for form elements.
*/
#[LegacyHook]
-function market_wave_preprocess_form_element(&$variables) {
- \Drupal::service(MarketWaveHooks::class)->preprocessFormElement($variables);
+function market_wave_preprocess_form_element(&$variables)
+{
+ \Drupal::service(MarketWaveHooks::class)->preprocessFormElement($variables);
}
diff -u b/src/Hook/MarketWaveHooks.php b/src/Hook/MarketWaveHooks.php
--- b/src/Hook/MarketWaveHooks.php
+++ b/src/Hook/MarketWaveHooks.php
@@ -4,85 +4,87 @@
+use Drupal\Component\Utility\DeprecationHelper;
+use Drupal\Core\Extension\ThemeSettingsProvider;
+use Drupal\file\Entity\File;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Url;
+use Drupal\user\Entity\User;
use Drupal\Core\Template\Attribute;
+use Drupal\Core\Link;
+use Drupal\Component\Utility\Html;
+use Drupal\Component\Utility\Xss;
+use Drupal\node\Entity\Node;
use Drupal\Component\Render\MarkupInterface;
-use Drupal\user\Entity\User;
-use Drupal\Core\Extension\ThemeSettingsProvider;
-use Drupal\Component\Utility\DeprecationHelper;
use Drupal\Core\Hook\Attribute\Hook;
-
/**
* Hook implementations for market_wave.
*/
-class MarketWaveHooks {
-
- /**
- * Implements hook_preprocess_HOOK() for region.html.twig.
- */
- #[Hook('preprocess_region')]
- public static function preprocessRegion(&$variables) {
- $nowrap = [
- 'primary_menu',
- 'secondary_menu',
- 'header',
- ];
- if (DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('market_wave_region_class_' . $variables['elements']['#region']), fn() => theme_get_setting('market_wave_region_class_' . $variables['elements']['#region'])) !== NULL) {
- $variables['attributes']['class'][] = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('market_wave_region_class_' . $variables['elements']['#region']), fn() => theme_get_setting('market_wave_region_class_' . $variables['elements']['#region']));
+class MarketWaveHooks
+{
+ /**
+ * Implements hook_preprocess_HOOK() for region.html.twig.
+ */
+ #[Hook('preprocess_region')]
+ public static function preprocessRegion(&$variables)
+ {
+ $nowrap = [
+ 'primary_menu',
+ 'secondary_menu',
+ 'header',
+ ];
+ if (\Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(\Drupal\Core\Extension\ThemeSettingsProvider::class)->getSetting('market_wave_region_class_' . $variables['elements']['#region']), fn() => theme_get_setting('market_wave_region_class_' . $variables['elements']['#region'])) !== NULL) {
+ $variables['attributes']['class'][] = \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(\Drupal\Core\Extension\ThemeSettingsProvider::class)->getSetting('market_wave_region_class_' . $variables['elements']['#region']), fn() => theme_get_setting('market_wave_region_class_' . $variables['elements']['#region']));
+ } elseif (!in_array($variables['elements']['#region'], $nowrap)) {
+ $variables['attributes']['class'][] = '';
+ }
+ }
+ /**
+ * Implements hook_theme_suggestions_HOOK_alter() for region templates.
+ */
+ #[Hook('theme_suggestions_region_alter')]
+ public static function themeSuggestionsRegionAlter(array &$suggestions, array $variables)
+ {
+ $nowrap = [
+ 'primary_menu',
+ 'secondary_menu',
+ 'header',
+ ];
+ if (\Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(\Drupal\Core\Extension\ThemeSettingsProvider::class)->getSetting('market_wave_region_clean_' . $variables['elements']['#region']), fn() => theme_get_setting('market_wave_region_clean_' . $variables['elements']['#region'])) !== NULL) {
+ $region_clean = \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(\Drupal\Core\Extension\ThemeSettingsProvider::class)->getSetting('market_wave_region_clean_' . $variables['elements']['#region']), fn() => theme_get_setting('market_wave_region_clean_' . $variables['elements']['#region']));
+ } else {
+ $region_clean = in_array($variables['elements']['#region'], $nowrap);
+ }
+ if ($region_clean) {
+ $suggestions[] = 'region__nowrap';
+ }
+ }
+ /**
+ * Implements hook_preprocess_comment() for getting first later of comment auther name.
+ */
+ #[Hook('preprocess_comment')]
+ public static function preprocessComment(&$variables)
+ {
+ $user = \Drupal\user\Entity\User::load($variables['author_id']);
+ if ($user->get('user_picture')->isEmpty()) {
+ $variables['comment_author'] = ucfirst(substr($user->get('name')->value, 0, 1));
+ }
+ }
+ /**
+ * Implements hook_preprocess_HOOK() for form elements.
+ */
+ #[Hook('preprocess_form_element')]
+ public static function preprocessFormElement(&$variables)
+ {
+ if (isset($variables['label']['#title'])) {
+ if (is_object($variables['label']['#title']) && !$variables['label']['#title'] instanceof \Drupal\Component\Render\MarkupInterface) {
+ $variables['input_title'] = NULL;
+ } elseif (is_object($variables['label']['#title'])) {
+ $variables['input_title'] = $variables['label']['#title'];
+ } else {
+ $variables['input_title'] = $variables['label']['#title'];
+ }
+ }
+ if (isset($variables['element']['#attributes'])) {
+ $variables['input_attributes'] = new \Drupal\Core\Template\Attribute($variables['element']['#attributes']);
+ }
}
- elseif (!in_array($variables['elements']['#region'], $nowrap)) {
- $variables['attributes']['class'][] = '';
- }
- }
-
- /**
- * Implements hook_theme_suggestions_HOOK_alter() for region templates.
- */
- #[Hook('theme_suggestions_region_alter')]
- public static function themeSuggestionsRegionAlter(array &$suggestions, array $variables) {
- $nowrap = [
- 'primary_menu',
- 'secondary_menu',
- 'header',
- ];
- if (DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('market_wave_region_clean_' . $variables['elements']['#region']), fn() => theme_get_setting('market_wave_region_clean_' . $variables['elements']['#region'])) !== NULL) {
- $region_clean = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('market_wave_region_clean_' . $variables['elements']['#region']), fn() => theme_get_setting('market_wave_region_clean_' . $variables['elements']['#region']));
- }
- else {
- $region_clean = in_array($variables['elements']['#region'], $nowrap);
- }
- if ($region_clean) {
- $suggestions[] = 'region__nowrap';
- }
- }
-
- /**
- * Implements hook_preprocess_comment() for getting first later of comment auther name.
- */
- #[Hook('preprocess_comment')]
- public static function preprocessComment(&$variables) {
- $user = User::load($variables['author_id']);
- if ($user->get('user_picture')->isEmpty()) {
- $variables['comment_author'] = ucfirst(substr($user->get('name')->value, 0, 1));
- }
- }
-
- /**
- * Implements hook_preprocess_HOOK() for form elements.
- */
- #[Hook('preprocess_form_element')]
- public static function preprocessFormElement(&$variables) {
- if (isset($variables['label']['#title'])) {
- if (is_object($variables['label']['#title']) && !$variables['label']['#title'] instanceof MarkupInterface) {
- $variables['input_title'] = NULL;
- }
- elseif (is_object($variables['label']['#title'])) {
- $variables['input_title'] = $variables['label']['#title'];
- }
- else {
- $variables['input_title'] = $variables['label']['#title'];
- }
- }
- if (isset($variables['element']['#attributes'])) {
- $variables['input_attributes'] = new Attribute($variables['element']['#attributes']);
- }
- }
-
}
diff -u b/theme-settings.php b/theme-settings.php
--- b/theme-settings.php
+++ b/theme-settings.php
@@ -4,7 +4,6 @@
* @file
* Implements().
*/
-
use Drupal\Component\Utility\DeprecationHelper;
use Drupal\Core\Extension\ThemeSettingsProvider;
use Drupal\Core\Form\FormStateInterface;