Comments

star-szr’s picture

Issue summary: View changes
Issue tags: +Novice

There are about 70 instances currently.

sun’s picture

Status: Active » Needs review
StatusFileSize
new1.31 KB

The easiest way to discover all instances is the kick-starting change in attached patch.

Status: Needs review » Needs work

The last submitted patch, 2: drupal8.library-attached.2.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
Issue tags: +JavaScript
StatusFileSize
new88.75 KB

Much more than 70 instances. That should be all of them. There was a problem in the comment module, not enough nesting. There are a couple of scripts in node module and another that need to be made into a library and function docs needs to be updated.

tim.plunkett’s picture

+++ b/core/includes/common.inc
@@ -2714,15 +2714,16 @@ function drupal_process_states(&$elements) {
+  list($module, $name) = explode('/', $library_name);

@@ -2780,9 +2781,10 @@ function drupal_add_library($module, $name, $every_page = NULL) {
+  list($extension, $name) = explode('/', $name);

Not that 'core/myspecial/snowflakelibrary' is valid, but this should be list($module, $name) = explode('/', $library_name, 2); just to be safe.

($module vs $extension here, plus we actually use $provider everywhere else in core)

star-szr’s picture

I should have said 70 using the grep in the OP.

Status: Needs review » Needs work

The last submitted patch, 4: core-library-shorthand-2203407-4.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new91.56 KB

addressing #5

Status: Needs review » Needs work

The last submitted patch, 8: core-library-shorthand-2203407-8.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new93.46 KB

Status: Needs review » Needs work

The last submitted patch, 10: core-library-shorthand-2203407-10.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new94.2 KB
new6.07 KB

attached interdiff with #4

Status: Needs review » Needs work

The last submitted patch, 12: core-library-shorthand-2203407-12.patch, failed testing.

nod_’s picture

StatusFileSize
new94.7 KB

Just a reroll, no interdiff.

Patching without pulling first, been a while since I made that mistake :p

Oh yeah but one change I made earlier is in the library_alter hook,

Before

function hook_library_alter(array &$library, $module, $name) {
  if ($module == 'core' && $name == 'jquery.ui.datepicker') {

when I use it and when I see it used, it's always a check on both module and library so I just removed the module part and send the whole dep string:

function hook_library_alter(array &$library, $name) {
  if ($name == 'core/jquery.ui.datepicker') {
nod_’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 14: core-library-shorthand-2203407-14.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new94.82 KB
new1.1 KB

All right, should be green.

Status: Needs review » Needs work

The last submitted patch, 17: core-library-shorthand-2203407-17.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new95.28 KB

aww cmon :p

Reroll, caching patch broke it.

sun’s picture

wim leers’s picture

I couldn't find anything broken in manual testing. I read the entire patch, and couldn't find any errors. This is pretty much RTBC, besides these nitpicks:

  1. +++ b/core/includes/common.inc
    @@ -2677,9 +2677,7 @@ function drupal_process_states(&$elements) {
    + * @param $library_name
      *   The name of the library to add.
    

    Does this still make sense? It's now a module-namespaced library name.

  2. +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
    @@ -353,16 +353,14 @@ public function getLangcodes() {
    -      $additional_libraries = array_udiff($plugin->getLibraries($editor), $libraries, function($a, $b) {
    -        return $a[0] === $b[0] && $a[1] === $b[1] ? 0 : 1;
    -      });
    +      $additional_libraries = array_diff($plugin->getLibraries($editor), $libraries);
    

    Nice :)

  3. +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php
    @@ -114,6 +114,7 @@ public function form(array $form, array &$form_state) {
    +        // @todo make library.
             'js' => array(drupal_get_path('module', 'node') . '/node.js'),
    
    @@ -154,6 +155,7 @@ public function form(array $form, array &$form_state) {
    +          // @todo make library.
               drupal_get_path('module', 'node') . '/node.js',
    
    @@ -196,6 +198,7 @@ public function form(array $form, array &$form_state) {
    +        // @todo make library.
             'js' => array(drupal_get_path('module', 'node') . '/node.js'),
    

    These are all for the same thing. Let's also create an issue for each @todo. Same for the few other analogous @todos you added.

sun’s picture

Let's remove those @todos from this patch - I've created child issues for those conversions instead:

#2205155: Convert custom_block.js into a library
#2205157: Convert locale.admin.css into a library
#2205161: Convert node.js into a library [LOL]

wim leers’s picture

nod_’s picture

StatusFileSize
new92.95 KB

Rerolled. And removed todos.

Status: Needs review » Needs work

The last submitted patch, 24: core-library-shorthand-2203407-24.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new93.61 KB

reroll…

sun’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, @nod_!

nod_’s picture

BTW updated https://drupal.org/node/1764252 to reflect api change.

sun’s picture

sun’s picture

The follow-up issues for converting straw individual files into libraries have patches now — but are blocked on this patch to get in first.

Would be great to move forward here.

sun’s picture

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

core-library-shorthand-2203407-26.patch no longer applies.

error: patch failed: core/modules/picture/lib/Drupal/picture/Plugin/Field/FieldFormatter/PictureFormatter.php:172
error: core/modules/picture/lib/Drupal/picture/Plugin/Field/FieldFormatter/PictureFormatter.php: patch does not apply

nod_’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs reroll
StatusFileSize
new93.6 KB
sun’s picture

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

core-library-shorthand-2203407-33.patch no longer applies.

error: patch failed: core/modules/user/lib/Drupal/user/RegisterFormController.php:44
error: core/modules/user/lib/Drupal/user/RegisterFormController.php: patch does not apply

nod_’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs reroll
StatusFileSize
new93.62 KB

Reroll

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 01a3e19 and pushed to 8.x. Thanks!

sun’s picture

Status: Fixed » Closed (fixed)

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

penyaskito’s picture