Skip to content

Commit

Permalink
SDPA-5959: Fix small coding standards issues
Browse files Browse the repository at this point in the history
  • Loading branch information
christopher-hopper committed May 19, 2022
1 parent 0d3cec6 commit 26f68ea
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 18 deletions.
2 changes: 1 addition & 1 deletion css/content_moderation.theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
}

.entity-moderation-form__item {
width: 50%
width: 50%;
}
10 changes: 6 additions & 4 deletions modules/tide_block_inactive_users/src/Form/SettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
Expand All @@ -14,6 +15,7 @@
* @package Drupal\tide_block_inactive_users\Form
*/
class SettingsForm extends ConfigFormBase {
use StringTranslationTrait;

/**
* A logger instance.
Expand Down Expand Up @@ -95,10 +97,10 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#title' => $this->t('Time unit'),
'#default_value' => $config->get('time_unit'),
'#options' => [
'day' => 'Day(s)',
'week' => 'Week(s)',
'month' => 'Month(s)',
'hour' => 'Hour(s)',
'day' => $this->t('Day(s)'),
'week' => $this->t('Week(s)'),
'month' => $this->t('Month(s)'),
'hour' => $this->t('Hour(s)'),
],
'#required' => TRUE,
];
Expand Down
2 changes: 1 addition & 1 deletion modules/tide_spell_checker/tide_spell_checker.install
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function tide_spell_checker_install() {
if (isset($rows)) {
$updated_rows = [];

foreach ($rows as $key => $row) {
foreach ($rows as $row) {
if ($row['name'] === 'Tools' && !in_array('Scayt', $row['items'])) {
array_splice($row['items'], 7, 0, 'Scayt');
}
Expand Down
4 changes: 3 additions & 1 deletion src/Form/NodeActionForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
Expand All @@ -16,6 +17,7 @@
* Provides nodes deletion confirmation form.
*/
class NodeActionForm extends ConfirmFormBase {
use StringTranslationTrait;

/**
* The current user.
Expand Down Expand Up @@ -133,7 +135,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$ops[] = [get_class($this) . '::doAction', [$ids, $this->action]];
}
$batch = [
'title' => t('Processing selected content'),
'title' => $this->t('Processing selected content'),
'operations' => $ops,
'finished' => [get_class($this), 'finishBatch'],
];
Expand Down
4 changes: 3 additions & 1 deletion src/Plugin/CKEditorPlugin/TideCallout.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Drupal\ckeditor\CKEditorPluginInterface;
use Drupal\ckeditor\CKEditorPluginButtonsInterface;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\editor\Entity\Editor;

/**
Expand All @@ -16,6 +17,7 @@
* )
*/
class TideCallout extends PluginBase implements CKEditorPluginInterface, CKEditorPluginButtonsInterface {
use StringTranslationTrait;

/**
* {@inheritdoc}
Expand Down Expand Up @@ -55,7 +57,7 @@ public function getButtons() {
// Return the CKEditor plugin button details.
return [
'TideCallout' => [
'label' => t('Callout template'),
'label' => $this->t('Callout template'),
'image' => $iconImage,
],
];
Expand Down
4 changes: 3 additions & 1 deletion src/Plugin/CKEditorPlugin/TideEmbeddedGoogleMapsButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\editor\Entity\Editor;

/**
Expand All @@ -23,6 +24,7 @@
* )
*/
class TideEmbeddedGoogleMapsButton extends CKEditorPluginBase {
use StringTranslationTrait;

/**
* {@inheritdoc}
Expand All @@ -36,7 +38,7 @@ public function getButtons() {
// the CKEditor plugin you are implementing.
return [
'wenzgmap' => [
'label' => t('Embedded Google Maps'),
'label' => $this->t('Embedded Google Maps'),
'image' => drupal_get_path('module', 'tide_core') . '/js/plugins/wenzgmap/icons/wenzgmap.png',
],
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceLabelFormatter;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;

/**
* Plugin implementation of the 'entity_reference_revisions_label' formatter.
Expand All @@ -21,6 +22,7 @@
* )
*/
class EntityReferenceRevisionsLabelFormatter extends EntityReferenceLabelFormatter {
use StringTranslationTrait;

/**
* {@inheritdoc}
Expand All @@ -37,7 +39,7 @@ public static function defaultSettings() {
public function settingsForm(array $form, FormStateInterface $form_state) {
$elements = parent::settingsForm($form, $form_state);
$elements['show_revision_number'] = [
'#title' => t('Show revision number of the referenced entity'),
'#title' => $this->t('Show revision number of the referenced entity'),
'#type' => 'checkbox',
'#default_value' => $this->getSetting('show_revision_number'),
];
Expand All @@ -51,7 +53,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
public function settingsSummary() {
$summary = parent::settingsSummary();
if ($this->getSetting('show_revision_number')) {
$summary[] = t('Show revision number of the referenced entity');
$summary[] = $this->t('Show revision number of the referenced entity');
}

return $summary;
Expand Down
6 changes: 4 additions & 2 deletions src/Plugin/Field/FieldWidget/PresetParagraphsWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drupal\tide_core\Plugin\Field\FieldWidget;

use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\paragraphs\Plugin\Field\FieldWidget\ParagraphsWidget;
use Drupal\Component\Utility\Html;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
Expand All @@ -26,6 +27,7 @@
* )
*/
class PresetParagraphsWidget extends ParagraphsWidget {
use StringTranslationTrait;

/**
* Indicates whether the current widget instance is in translation.
Expand All @@ -52,7 +54,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
$form['preset_number'] = [
'#type' => 'number',
'#title' => 'Default number of paragraphs',
'#description' => t('Set the default number of paragraphs.'),
'#description' => $this->t('Set the default number of paragraphs.'),
'#min' => 1,
'#default_value' => $this->getSetting('preset_number'),
];
Expand All @@ -65,7 +67,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
*/
public function settingsSummary() {
$summary = parent::settingsSummary();
$summary[] = t('Number of paragraphs: @number', ['@number' => $this->getSetting('preset_number')]);
$summary[] = $this->t('Number of paragraphs: @number', ['@number' => $this->getSetting('preset_number')]);

return $summary;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Plugin/views/filter/EnhancedMineTypeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drupal\tide_core\Plugin\views\filter;

use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\views\Plugin\views\filter\InOperator;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
Expand All @@ -14,13 +15,14 @@
* @ViewsFilter("tide_enhanced_mime_type_filter")
*/
class EnhancedMineTypeFilter extends InOperator {
use StringTranslationTrait;

/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
$this->valueTitle = t('Enhanced MIME Type Filter');
$this->valueTitle = $this->t('Enhanced MIME Type Filter');
$this->definition['options callback'] = [$this, 'generateOptions'];
}

Expand Down
7 changes: 3 additions & 4 deletions tide_core.install
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,6 @@ function tide_core_update_8030() {
->getStorage('entity_view_display');
$skipped_items = ['title', 'uuid', 'created'];
foreach ($node_types as $node_type_id => $node_type) {
$order = [];
$entity_view_display_id = 'node.' . $node_type_id . '.default';
$field_name = 'field_' . $node_type_id . '_intro_text';
// Some of fields named as field_{node_type_id}_intro_text,
Expand Down Expand Up @@ -921,7 +920,7 @@ function tide_core_update_8034() {
$config = \Drupal::configFactory()
->getEditable('field.storage.paragraph.field_paragraph_accordion_style');
$settings = $config->get('settings');
foreach ($settings['allowed_values'] as $key => &$allowed_value) {
foreach ($settings['allowed_values'] as &$allowed_value) {
if ($allowed_value['label'] == 'Basic') {
$allowed_value['label'] = 'Standard';
}
Expand Down Expand Up @@ -1003,7 +1002,7 @@ function tide_core_update_8038() {
}
$updated_rows = [];

foreach ($rows as $key => $row) {
foreach ($rows as $row) {
if ($row['name'] === 'Media' && !in_array('TideCallout', $row['items'])) {
// Insert tide_callout inside Media group toolbar.
array_splice($row['items'], 1, 0, 'TideCallout');
Expand Down Expand Up @@ -1106,7 +1105,7 @@ function tide_core_update_8043() {
}
$updated_rows = [];

foreach ($rows as $key => $row) {
foreach ($rows as $row) {
if ($row['name'] === 'Tools' && !in_array('Maximize', $row['items'])) {
// Insert Maximise inside Tools group toolbar.
array_splice($row['items'], 3, 0, 'Maximize');
Expand Down

0 comments on commit 26f68ea

Please sign in to comment.