Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
Problem/Motivation
Current functionality only allows for single node values via given filter types.
Steps to reproduce
1. Use either filters and scrape the markup.
2. The result set in the Migrate Source Plugin is either a single value or the single value of the first node the Crawler finds.
Proposed resolution
Make it possible to fetch multiple values from the Xpath or Selector filters types.
Remaining tasks
1. Review change request
2. Create Patch
3. Review and test functionality
4. Document changes
User interface changes
N/A
API changes
N/A
Data model changes
An updated example with the new fields that feeds into "sub_process" and "migration_lookup" Migrate Processes.
source:
plugin: php_scraper
fields:
categories:
xpath: '//a/@href'
get: text
multiple: true
key: example_id
ids:
- id
process:
upload:
plugin: sub_process
source: categories
process:
target_id:
-
plugin: str_replace
regex: true
source: example_id
search: /[^0-9]/
replace: $1
-
plugin: migration_lookup
migration: example_taxonomy_categories
migration_dependencies:
required:
- example_taxonomy_categories
Comment | File | Size | Author |
---|---|---|---|
#4 | migrate_source_scraper-multiple_values_support-3499997-4.patch | 2.18 KB | baikho |
Issue fork migrate_source_scraper-3499997
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
Comment #3
baikhoComment #4
baikhoComment #5
reinchekHi @baikho, thank you for your contribution!
Tomorrow, I will test your feature request and, if everything works well, I will create an initial alpha release with the patch merged.
Thanks! 😉