- Issue created by @vishal-yadav
- Status changed to Needs review
7 months ago 11:09am 10 April 2024 - last update
7 months ago 182 pass - 🇪🇸Spain cmarrufo
Hi @vishal-yaduvanshi
I have had the same problem and I think it would be a good idea to have a paragraphs type finder so I have made a patch that I think you could use.
- 🇮🇳India vishal-yadav
hey @cmarrufo
thank you for your response, this functionality is very useful for me and the community of Drupal.
- Status changed to RTBC
5 months ago 2:11am 18 June 2024 - Status changed to Needs work
3 months ago 11:34am 6 August 2024 - 🇨🇭Switzerland berdir Switzerland
Looks intersting, but all non-trivial contributions must be merge requests now. A test would be great as well, but I can live without for non-critical functionality.
- 🇨🇭Switzerland berdir Switzerland
-
+++ b/src/Controller/ParagraphsTypeListBuilder.php @@ -63,9 +73,123 @@ class ParagraphsTypeListBuilder extends ConfigEntityListBuilder { + + $search_param = \Drupal::request()->get('search'); + $query = $this->getStorage()->getQuery(); + + if ($search_param) { + $orCondition = $query->orConditionGroup() + ->condition('label', $search_param, 'CONTAINS') + ->condition('id', $search_param, 'CONTAINS'); + $query->condition($orCondition); + $entity_ids = $query->execute(); + $filtered_array = []; +
if we stick with a server-side implementation then this should override the getEntityListQuery() method, so we don't need to query and list twice.
-
+++ b/src/Controller/ParagraphsTypeListBuilder.php @@ -63,9 +73,123 @@ class ParagraphsTypeListBuilder extends ConfigEntityListBuilder { + public function buildForm(array $form, FormStateInterface $form_state) { + $form['search'] = [ + '#type' => 'textfield', + '#title' => $this->t('Search'), + '#default_value' => \Drupal::request()->query->get('search'), + '#description' => $this->t('Search paragraphs types by Label or ID'),
would it make sense to default the focus on this field, then you can visit and type immediately.
I'm also wondering if this should be a client-side functionality, similar to how \Drupal\views_ui\ViewListBuilder::render does it. That would require no reloads. would require to disable the pager, like views does.
-
- Assigned to cmarrufo
- Merge request !141Issue #3425503 by cmarrufo, vishal-yadav: Add paragraphs search functionality → (Open) created by cmarrufo
- Status changed to Needs review
3 months ago 3:17pm 26 August 2024