Loading images/down-arrow.svg 0 → 100644 +3 −0 Original line number Diff line number Diff line <svg width="12" height="7" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M1.5 0.749999L6 5.25L10.5 0.75" stroke="#232429" stroke-width="2"/> </svg> src/Controller/ProjectBrowserEndpointController.php +33 −4 Original line number Diff line number Diff line Loading @@ -77,15 +77,44 @@ class ProjectBrowserEndpointController extends ControllerBase { } // Validate and build query. $direction = $request->query->get('direction'); $query = [ // Page and limit are checked against a valid list in in_array, below. 'page' => (int) $request->query->get('page', 0), 'limit' => (int) $request->query->get('limit', 12), 'sort' => Xss::filter($request->query->get('sort', '')), 'direction' => in_array($direction, ['ASC', 'DESC']) ? $direction : 'ASC', ]; $sort = $request->query->get('sort'); if ($sort) { $direction = $request->query->get('direction'); $direction = ($direction == 'ASC') ? 'ASC' : 'DESC'; // Values offered in the front-end. $accepted_sort_values = [ 'usage_total', 'a_z', 'z_a', 'created', 'best_match', ]; if (in_array($sort, $accepted_sort_values)) { // Transform to values accepted by the plugins. See options in the // comments here: ProjectBrowserSourceInterface::getProjects. switch ($sort) { case 'a_z': $sort = 'title'; $direction = 'ASC'; break; case 'z_a': $sort = 'title'; $direction = 'DESC'; break; } $query['sort'] = $sort; $query['direction'] = $direction; } } $title = $request->query->get('search'); if ($title) { $query['search'] = Xss::filter($title); Loading src/Plugin/ProjectBrowserSource/MockDrupalDotOrg.php +5 −7 Original line number Diff line number Diff line Loading @@ -266,20 +266,18 @@ class MockDrupalDotOrg extends PluginBase implements ProjectBrowserSourceInterfa $accepted_sort_values = [ 'usage_total', 'created', 'changed', 'star_user_count', 'title', 'author', // 'best_match', 'best_match', ]; $direction = (array_key_exists('direction', $query) && $query['direction'] == 'ASC') ? 'ASC' : 'DESC'; if (in_array($sort, $accepted_sort_values)) { // Map any sort values from the controller to the actual data. if ($sort == 'usage_total') { $sort = 'project_usage_total'; } elseif ($sort == 'star_user_count') { $sort = 'flag_project_star_user_count'; elseif ($sort == 'best_match') { $sort = 'project_usage_total'; } $direction = (array_key_exists('direction', $query) && $query['direction'] == 'ASC') ? 'ASC' : 'DESC'; $db_query->orderBy($sort, $direction); } } Loading src/Plugin/ProjectBrowserSourceInterface.php +2 −5 Original line number Diff line number Diff line Loading @@ -33,15 +33,12 @@ interface ProjectBrowserSourceInterface { * * The "sort" query field accepts the following values: * - 'usage_total' * - 'created' * - 'changed' * - 'star_user_count' * - 'title' * - 'author' * - 'created' * - 'best_match' * * @return \Drupal\project_browser\ProjectBrowser\ProjectsResultsPage * Returns a \Drupal\project_browser\ProjectBrowser\ProjectsResultsPage * Returns a \Drupal\project_browser\ProjectBrowser\ProjectsResultsPage. */ public function getProjects(array $query = []): ProjectsResultsPage; Loading sveltejs/public/build/bundle.css +0 −0 File changed.Preview suppressed by a .gitattributes entry or the file's encoding is unsupported. View original file View changed file Loading
images/down-arrow.svg 0 → 100644 +3 −0 Original line number Diff line number Diff line <svg width="12" height="7" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M1.5 0.749999L6 5.25L10.5 0.75" stroke="#232429" stroke-width="2"/> </svg>
src/Controller/ProjectBrowserEndpointController.php +33 −4 Original line number Diff line number Diff line Loading @@ -77,15 +77,44 @@ class ProjectBrowserEndpointController extends ControllerBase { } // Validate and build query. $direction = $request->query->get('direction'); $query = [ // Page and limit are checked against a valid list in in_array, below. 'page' => (int) $request->query->get('page', 0), 'limit' => (int) $request->query->get('limit', 12), 'sort' => Xss::filter($request->query->get('sort', '')), 'direction' => in_array($direction, ['ASC', 'DESC']) ? $direction : 'ASC', ]; $sort = $request->query->get('sort'); if ($sort) { $direction = $request->query->get('direction'); $direction = ($direction == 'ASC') ? 'ASC' : 'DESC'; // Values offered in the front-end. $accepted_sort_values = [ 'usage_total', 'a_z', 'z_a', 'created', 'best_match', ]; if (in_array($sort, $accepted_sort_values)) { // Transform to values accepted by the plugins. See options in the // comments here: ProjectBrowserSourceInterface::getProjects. switch ($sort) { case 'a_z': $sort = 'title'; $direction = 'ASC'; break; case 'z_a': $sort = 'title'; $direction = 'DESC'; break; } $query['sort'] = $sort; $query['direction'] = $direction; } } $title = $request->query->get('search'); if ($title) { $query['search'] = Xss::filter($title); Loading
src/Plugin/ProjectBrowserSource/MockDrupalDotOrg.php +5 −7 Original line number Diff line number Diff line Loading @@ -266,20 +266,18 @@ class MockDrupalDotOrg extends PluginBase implements ProjectBrowserSourceInterfa $accepted_sort_values = [ 'usage_total', 'created', 'changed', 'star_user_count', 'title', 'author', // 'best_match', 'best_match', ]; $direction = (array_key_exists('direction', $query) && $query['direction'] == 'ASC') ? 'ASC' : 'DESC'; if (in_array($sort, $accepted_sort_values)) { // Map any sort values from the controller to the actual data. if ($sort == 'usage_total') { $sort = 'project_usage_total'; } elseif ($sort == 'star_user_count') { $sort = 'flag_project_star_user_count'; elseif ($sort == 'best_match') { $sort = 'project_usage_total'; } $direction = (array_key_exists('direction', $query) && $query['direction'] == 'ASC') ? 'ASC' : 'DESC'; $db_query->orderBy($sort, $direction); } } Loading
src/Plugin/ProjectBrowserSourceInterface.php +2 −5 Original line number Diff line number Diff line Loading @@ -33,15 +33,12 @@ interface ProjectBrowserSourceInterface { * * The "sort" query field accepts the following values: * - 'usage_total' * - 'created' * - 'changed' * - 'star_user_count' * - 'title' * - 'author' * - 'created' * - 'best_match' * * @return \Drupal\project_browser\ProjectBrowser\ProjectsResultsPage * Returns a \Drupal\project_browser\ProjectBrowser\ProjectsResultsPage * Returns a \Drupal\project_browser\ProjectBrowser\ProjectsResultsPage. */ public function getProjects(array $query = []): ProjectsResultsPage; Loading
sveltejs/public/build/bundle.css +0 −0 File changed.Preview suppressed by a .gitattributes entry or the file's encoding is unsupported. View original file View changed file