Problem/Motivation

Migration_tools doesn't currently support the ability to find and concat. This should behave identical to pluckAndConcatAnySelector but instead of plucking it just finds and doesn't remove the element

Bonus points for supporting xpath.

Proposed resolution

Create new method findAndConcatAnySelector. Have optional settings to allow for xpath query.

Command icon 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

robpowell created an issue. See original summary.

robpowell’s picture

Status: Active » Needs review
swirt’s picture

Thanks for this contribution @robpowell. I really like the way that you added extra params to make it more versatile.

I was concerned about having a finder that is called differently than the plucker, so expanded existing plucker to user your logic and then made the finder just call the plucker with the pluck flag set to false.

I also added another arg that lets you control the separator.

/**
   * Finder crawls $selector elements and concats them as it goes.
   *
   * @param string $selector
   *   The selector to find.
   * @param string $method
   *   (optional) The method to use on the element, text or html. Default: text.
   * @param string $qp_method
   *   (optional) The QueryPath method to use.
   * @param string $separator
   *   (optional)  The separator to use between the concatenation.
   *
   * @return string
   *   Concatenation of all selector elements' text.
   */
  protected function findAndConcatAnySelector

  • swirt committed fc46154 on 8.x-2.x
    Issue #3211980 by robpowell, swirt: Add finder findAndConcatAnySelector.
    
swirt’s picture

Status: Needs review » Fixed
swirt’s picture

Status: Fixed » Closed (fixed)