Problem/Motivation

It's looking like #3450629: Create a block that allows us to place project browser instances anywhere is going to take a substantial amount of work and refactoring. As part of that, we need to be able to consistently drop a Project Browser instance (and its associated settings, CSS, etc.) anywhere on a page. That would be accomplished most easily if there were an encapsulated render element for the project browser.

Proposed resolution

Create a project_browser render element that does pretty much all the same stuff as is done in BrowserController, and then change BrowserController to use that render element.

CommentFileSizeAuthor
#6 project-browser-element.png608.13 KBprashant.c
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

phenaproxima created an issue. See original summary.

yash.rode made their first commit to this issue’s fork.

yash.rode’s picture

Assigned: Unassigned » yash.rode
yash.rode’s picture

Assigned: yash.rode » Unassigned
Status: Active » Needs review
prashant.c’s picture

StatusFileSize
new608.13 KB

@yash.rode
Great work.

Tried the element on a Custom Form

$form['pb'] = [
      '#type' => 'project_browser',
];

and it worked well.

Project Browser Element

But I see there is another property #source I am assuming this is to restrict the list to the supplied source only like drupal_core or drupalorg_jsonapi source etc. I tried this property but nothing happening. Both sources are already enabled.

Could you please provide some details on how to use these properties #source and #id?

Thanks

yash.rode’s picture

Hi @Prashant.c as you can see the path /admin/modules/browse/{source}/{id}' when viewing the /admin/modules/browse page both $source and $id are null and for a details page like http://starshot.test/admin/modules/browse/recipes/drupal-core-core_recommended_admin_theme where source is recipes and id is drupal-core-core_recommended_admin_theme. In that case one can use the #source and #id to see the detail page of specific recipes/module.

phenaproxima’s picture

Status: Needs review » Needs work

Pretty close, just a few more points.

prashant.c’s picture

#7, thanks for the clarifications, as mentioned by @phenaproxima having the properties documented in the the doc comments would be helpful.

phenaproxima’s picture

Status: Needs work » Reviewed & tested by the community

@yash.rode pointed me to a very tricky bug, and I found the root cause -- but credit where credit is due, because I would have had a much harder time tracing it if Yash hadn't expertly isolated the problem. It's fixed now - awesome teamwork!

Other than that, I think this MR looks great. Ship it!

phenaproxima’s picture

Status: Reviewed & tested by the community » Needs work

Ugh, guess we need a little more work to get the tests passing. Poop.

phenaproxima’s picture

Status: Needs work » Reviewed & tested by the community
yash.rode’s picture

The test failure is because of #3458908: Remove Modals after They're Closed which is merged in upstream.

prashant.c’s picture

It looks like this test failinghttps://git.drupalcode.org/project/project_browser/-/blob/2.0.x/tests/src/FunctionalJavascript/ProjectBrowserUiTest.php?ref_type=heads

chrisfromredfin made their first commit to this issue’s fork.

chrisfromredfin’s picture

Status: Reviewed & tested by the community » Fixed

Excellent behind-the-scenes work

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.