Issue #3293581 by Ashutosh Ahirwal: phpcs --standard=Drupal
Open
requested to merge issue/interface_views_sort-3293581:3293581-phpcs---standarddrupal into 1.0.x
3 unresolved threads
Closes #3293581
Merge request reports
Activity
added 1 commit
- 6a5e75fb - fixed Use statements should be sorted alphabetically error.
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. changed this line in version 4 of the diff
Please register or sign in to reply