Updated: Comment #32
Problem/Motivation
Convert shortcut_link_add and shortcut_link_edit to new-style Controllers. To reproduce:
- Install a clean instance of D8.
- Verify on admin/config/user-interface/shortcut that there is no "Add Shortcut Set" button
Proposed resolution
Use the instructions on https://drupal.org/node/1953342.
Remaining tasks
The following issues remain:
#1: When visiting admin/config/user-interface/shortcut/add-set
, the following error appears:
InvalidArgumentException: The entity type (shortcut_set) did not specify a form controller: add. in Drupal\Core\Entity\EntityManager->getControllerClass() (line 170 of /Users/luke/Sites/d8core.dev/www/core/lib/Drupal/Core/Entity/EntityManager.php).
#2: When listing links (eg: admin/config/user-interface/shortcut/manage/default
) or editing a shortcut set (eg: admin/config/user-interface/shortcut/manage/default/edit
) the following error appears:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'shortcut_set_edit_access' not found or invalid function name in _menu_check_access() (line 602 of core/includes/menu.inc).
#3: When attempting to edit or delete a shortcut from a set, I get partially-rendered page with no errors (but am unable to edit or delete the link). From my Apache error log:
PHP Fatal error: Class 'Drupal\\shortcut\\Access\\LinkDeleteAccessCheck' not found in /Users/luke/Sites/d8core.dev/www/sites/default/files/php/service_container/service_container_prod.php/8fc78707b0474cc1c72a8e089285931009388c205d990b9acf87cef0625d5fd1.php on line 482, referer: http://d8core.dev/admin/config/user-interface/shortcut/manage/default
Related Issues
Part of #1971384: [META] Convert page callbacks to controllers
Comment | File | Size | Author |
---|---|---|---|
#33 | drupal8.shortcut-module.1978966-33.patch | 27.29 KB | lukewertz |
#28 | shortcut-1978966-28.patch | 29.23 KB | tim.plunkett |
#28 | interdiff.txt | 8.04 KB | tim.plunkett |
#26 | shortcut-1978966-26.patch | 25.24 KB | tim.plunkett |
#26 | interdiff.txt | 22.31 KB | tim.plunkett |
Comments
Comment #1
sidharthapHere is the first patch for this issue. Please comment to make it better.
Comment #3
sidharthapA new patch. making some correction in controller class.
Comment #4
tim.plunkettBlocks #1908756: Separate Action Links (MENU_LOCAL_ACTION) from hook_menu()
Comment #5
ParisLiakos CreditAttribution: ParisLiakos commentedthanks:)
class name should be uppercase first
lets inject entity manager, like you did for module handler,
same for path alias manager
i cant see them used anywhere, you should inject the two managers i pointed above instead
Comment #6
sidharthapComment #8
sidharthapComment #10
sidharthapThe patch fails at "patch failed: core/modules/shortcut/shortcut.routing.yml:15"
The line is the route name shortcut_set_admin. why it is failing ?
Comment #11
ParisLiakos CreditAttribution: ParisLiakos commentedmaybe apply manually the changes to routing file and reroll?
Comment #12
sidharthapComment #13
InternetDevels CreditAttribution: InternetDevels commented#12: shortcut-link-add-1978966-12.patch queued for re-testing.
Comment #14
ParisLiakos CreditAttribution: ParisLiakos commentedi dont think you should move this function to the module file..instead in the controller, you can loadInclude the file using the module_handler service (injected or by \Drupal::moduleHandler() with an @todo above it)
this needs a better naming a la OOP and visibility to protected eg, protected funtion linkFormElements
Comment #15
somepal CreditAttribution: somepal commentedworking on this..
Comment #16
somepal CreditAttribution: somepal commentedThis might not be correct but the 'add shortcut' link on /index.php/admin/config/user-interface/shortcut/manage/default went missing after changes as in the interdiff.
Comment #17
vijaycs85Needed a re-roll and fixed #14
Comment #18
dawehnerit would be nice to also return static::ALLOW or static::DENY
Let's typehint this variable.
Comment #19
vijaycs85Thanks for the quick review @dawehner. here is the patch that fixes #18
Comment #20
tim.plunkettIs this really an array? I thought it was a MenuLinkInterface, but MenuLink just uses ArrayAccess...
Comment #22
tim.plunkettWorking on this, and merging with #1978972: Convert shortcut_link_edit to a Controller
Comment #23
tim.plunkettPosting some progress for now, does not include edit yet.
Comment #24
jibranCan we create shortcutManger for these helper methods and inject manger?
Are we going to handle this in this issue or follow up?
update doesn't seems right it should be add/create
Comment #25
tim.plunkettI will see what's left of those functions when I finish refactoring, same for local action/tasks
It's add/create of the *shortcut link*, which is currently just a menu link. But the access checks are 100% identical to updating a *shortcut set*
Comment #26
tim.plunkettDoing something with shortcut_valid_link() should be a follow-up.
Until the local action/task APIs are fixed, not bothering with that either.
Comment #27
jibranTested on simpletest.me works fine. @tim.plunkett awesome work turning
_shortcut_link_form_elements
to aShortcutLinkFormBase
. RTBC if it is green.This can be removed now and we can eject
moduleHandler
from the controller as well.Comment #28
tim.plunkettWent through and cleaned everything up, including removing unneeded services, and injecting the entity manager into the access check.
Comment #29
jibranThanks for the clean up.
Comment #30
alexpottThis patch adds a button on admin/config/user-interface/shortcut which links to admin/config/user-interface/shortcut/add-set which gets the following error...
InvalidArgumentException: The entity type (shortcut_set) did not specify a form controller: add. in Drupal\Core\Entity\EntityManager->getControllerClass() (line 170 of /Volumes/devdisk/dev/sites/drupal8alt.dev/core/lib/Drupal/Core/Entity/EntityManager.php).
However the add set from the profile account tab is still working.
Additionally, on admin/config/user-interface/shortcut each shortcut set has an "edit menu" operation which is weird as it goes to the edit shortcut set name page...
Comment #31
tim.plunkettPostponing on #2021779: Decouple shortcuts from menu links anyway.
Comment #32
lukewertzUpdated: Comment #32
Problem/Motivation
Convert shortcut_link_add and shortcut_link_edit to new-style Controllers. To reproduce:
Proposed resolution
Use the instructions on https://drupal.org/node/1953342.
Remaining tasks
The following issues remain:
#1: When visiting
admin/config/user-interface/shortcut/add-set
, the following error appears:#2: When listing links (eg:
admin/config/user-interface/shortcut/manage/default
) or editing a shortcut set (eg:admin/config/user-interface/shortcut/manage/default/edit
) the following error appears:#3: When attempting to edit or delete a shortcut from a set, I get partially-rendered page with no errors (but am unable to edit or delete the link). From my Apache error log:
Related Issues
Part of #1971384: [META] Convert page callbacks to controllers
Comment #33
lukewertzHere is a re-rolled patch. None of the issues in the summary are addressed in this patch.
Comment #34
tim.plunkettThis issue is postponed because the shortcuts are slated to be completely rearchitected. The work I did (which you rerolled, thanks!) is probably useless...
Comment #34.0
tim.plunkettUpdating this following the issue summary template.
Comment #35
jibranCan we close it as duplicate?
Comment #36
andypostComment #38
tim.plunkettDupe of #2021779: Decouple shortcuts from menu links