Hello. I have already finished porting this module to Drupal 8. You can see code of Drupal 8 module here: https://github.com/mkdok/d8-shortcutperrole

Also, I created patch that is based on 7.x-1.2 branch. Review it please.

Thanks.

Comments

mkdok created an issue. See original summary.

mkdok’s picture

andypost’s picture

Status: Needs review » Needs work
  1. +++ b/shortcutperrole.install
    @@ -9,5 +9,5 @@
     function shortcutperrole_uninstall() {
    -  variable_del('shortcutperrole');
    +  \Drupal::service('config.factory')->getEditable('shortcutperrole')->delete();
    

    config system should remove owned data itself

  2. +++ b/src/Form/ShortcutPerRoleSettingsForm.php
    @@ -0,0 +1,87 @@
    +    $form['title'] = array(
    +      '#markup' => '<h3 class="title">' . $this->t('Assign Shortcuts for  Role:') .
    +        '</h3>',
    +    );
    

    suppose that should be a page title!
    use title_callback or $form['#title']

  3. +++ b/src/Form/ShortcutPerRoleSettingsForm.php
    @@ -0,0 +1,87 @@
    +      $form['shortcutperrole'] [$rid ] = array(
    ...
    +        '#prefix' => '<b>' . $role->label() . '</b>' ,
    

    please use #title property

  4. +++ b/src/Form/ShortcutPerRoleSettingsForm.php
    @@ -0,0 +1,87 @@
    +    $url = Url::fromRoute('shortcut.set_add');
    +    $link = Link::createFromRoute('Add a shortcut set', $url->getRouteName());
    +
    +    $form['create_new_ss'] = array(
    +      '#markup' => '<h3 class="title">' . $link->toString() . '</h3>',
    +    );
    

    there's #type => 'link' for that
    but I suggest to add action link with "destination' to that page

mkdok’s picture

StatusFileSize
new10.6 KB

Hello. I have already made necessary fixes according to #3. Please review my new patch.

mkdok’s picture

Status: Needs work » Needs review
andypost’s picture

Status: Needs review » Reviewed & tested by the community

Looks good forms, further cleanup could be done in follows

  • mkdok committed 2f2ff92 on 8.x-1.x
    Issue #2734231 by mkdok: Port to Drupal 8
    
mkdok’s picture

Version: 7.x-1.2 » 8.x-1.x-dev
Status: Reviewed & tested by the community » Closed (fixed)
andypost’s picture

Assigned: mkdok » Unassigned
Status: Closed (fixed) » Fixed

Proper status, it lets issue to be visible 2 weeks in queue

Status: Fixed » Closed (fixed)

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