Skip to content
Snippets Groups Projects

Issue #3293581 by Ashutosh Ahirwal: phpcs --standard=Drupal

3 unresolved threads
3 unresolved threads

Closes #3293581

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
18
12 * Basic sort handler for dates.
13 *
14 * This handler enables granularity, which is the ability to make dates
15 * equivalent based upon nearness.
16 *
17 * @ViewsSort("language_switcher_sort")
18 */
19 19 class LanguageSwitcherSort extends HandlerBase implements CacheableDependencyInterface {
20 20
21 protected function defineOptions() {
22 return parent::defineOptions();
23 }
21 /**
22 * Simple validate handler.
23 */
  • 22 return parent::defineOptions();
    23 }
    21 /**
    22 * Simple validate handler.
    23 */
    24 protected function sortValidate(&$form, FormStateInterface $form_state) {}
    24 25
    25 /**
    26 * Basic options for all sort criteria
    27 */
    28 public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    29 parent::buildOptionsForm($form, $form_state);
    30 }
    26 /**
    27 * Simple submit handler.
    28 */
  • 77 */
    78 public function getCacheTags() {
    79 return [];
    80 }
    81
    82 /**
    83 * Called to add the sort to a query.
    84 */
    85 public function query() {
    86 $currentLangcode = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId();
    87 $language = "FIELD(node_field_data.langcode, '$currentLangcode')";
    88 $this->query->addField(NULL, $language, 'language');
    89 $this->query->addOrderBy(NULL, NULL, 'DESC', 'language');
    90 }
    77 /**
    78 * Called to add the sort to a query.
  • added 1 commit

    • 23fc7d05 - Used {@inheritdoc} for inherited methods

    Compare with previous version

  • shruu_rao added 1 commit

    added 1 commit

    Compare with previous version

  • Please register or sign in to reply
    Loading