Problem/Motivation

In #2912353: Handle menu_items related to Drupal 6 and 7 node translations with different IDs we added a new configuration option validate_route to ignore route validation but there is no documentation in the plugin's annotation to document it.

Proposed resolution

Let's document this plugin.

Also, we should figure out and document (or fix) why the plugin expects an array and then only use the first item:

  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    list($path) = $value;
    [...]
  }

Remaining tasks

  • Write documentation
  • Figure out why the plugin expects an array and only use the first item
  • Review

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

maxocub created an issue. See original summary.

maxocub’s picture

Issue summary: View changes

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

fenstrat’s picture

Issue summary: View changes
mr.baileys’s picture

Status: Active » Needs review
StatusFileSize
new7.23 KB

Also, we should figure out and document (or fix) why the plugin expects an array and then only use the first item

This plugin was initially added in #2417793-13: Allow entity: URIs to be entered in link fields, but the issue thread does not focus on the plugin itself (initially called userpath_uri). I dug through all commits for the LinkUri process plugin, but as far as I can track down, there is no reason (and never was) to expect an array as input, and requiring it to be an array seems to be unintentional.

Patch attached that contains a first attempt at documenting the LinkUri plugin, while at the same time deprecating the option to pass in an array as source value. Not sure if this deprecation strategy is acceptable, or if the deprecation itself requires a test.

phenaproxima’s picture

Status: Needs review » Needs work
Issue tags: +Needs followup

The documentation looks good, but this patch is making a lot of changes which are not related to the documentation at all. Those changes are fine and good, but they are out of scope for this issue. It'd be better to remove all non-documentation changes from the current patch, then open a separate issue to streamline the value handling.

mr.baileys’s picture

Issue tags: -Needs followup

Thanks @phenaproxima, I have opened #3031528: LinkUri source value should not be an array. to address the source value handling.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mr.baileys’s picture

Status: Needs work » Needs review
StatusFileSize
new1.42 KB

#3031528: LinkUri source value should not be an array. has landed, here is a patch with just the documentation changes from the patch in #5.

mikelutz’s picture

Status: Needs review » Reviewed & tested by the community

LGTM Thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 9: 2954908-9-document-link-uri.patch, failed testing. View results

mikelutz’s picture

Status: Needs work » Reviewed & tested by the community

Looks like a testbot hiccup

quietone’s picture

Status: Reviewed & tested by the community » Needs work

Yes, really thanks!

I've got a few points though.

  1. +++ b/core/modules/menu_link_content/src/Plugin/migrate/process/LinkUri.php
    @@ -12,9 +12,28 @@
    + *   values are ignored. Passing the source value as an array is deprecated.
    

    Documenting deprecated behaviour seems wrong to me. Is this normally done? I'd prefer it was removed

  2. +++ b/core/modules/menu_link_content/src/Plugin/migrate/process/LinkUri.php
    @@ -12,9 +12,28 @@
    + * Examples:
    

    The example needs an explanation following it, after the @endcode. This was done for all the ones in migrate and we should keep up the practice.

  3. +++ b/core/modules/menu_link_content/src/Plugin/migrate/process/LinkUri.php
    @@ -12,9 +12,28 @@
    + *   "link/uri":
    

    Remove the quotes, they are not needed

idebr’s picture

Status: Needs work » Needs review
StatusFileSize
new1.61 KB
new1.54 KB

#13.1 Removed the documentation for the deprecated usage. The deprecated usage is already documented in the @trigger_error function:

    if (is_array($value)) {
      $value = reset($value);
      @trigger_error('Passing an array as source value into the link_uri migrate process plugin is deprecated in drupal:8.8.0. The possibility to pass an array as source value to the plugin will be removed in drupal:9.0.0. Pass a string value instead. See https://www.drupal.org/node/3043694', E_USER_DEPRECATED);
    }

#13.2 Added an explanation with an example entry, similar to for example \Drupal\migrate\Plugin\migrate\process\Concat

#13.3 Removed the quotes.

idebr’s picture

StatusFileSize
new691 bytes
new1.54 KB

Fixed the magically changing node id.

fenstrat’s picture

Status: Needs review » Reviewed & tested by the community

@quietone's review from #13 has been address, this looks RTBC to me.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 15: 2954908-15.patch, failed testing. View results

yogeshmpawar’s picture

Status: Needs work » Reviewed & tested by the community

All looks good so setting back to RTBC! Tests failure is not related (see #3055648: Frequent random fail in \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTest).

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 15: 2954908-15.patch, failed testing. View results

idebr’s picture

Status: Needs work » Reviewed & tested by the community

Same random failure as mentioned in #18.

xurizaemon’s picture

Somebody get testbot a glass of water!

  • catch committed fdccb84 on 8.8.x
    Issue #2954908 by idebr, mr.baileys, maxocub, fenstrat, quietone,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed fdccb84 and pushed to 8.8.x. Thanks!

Status: Fixed » Closed (fixed)

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