You are here

protected function ImageWidgetCropTest::getButtonName in Image Widget Crop 8.2

Gets IEF button name.

Parameters

string $xpath: Xpath of the button.

Return value

string The name of the button.

File

tests/src/FunctionalJavascript/ImageWidgetCropTest.php, line 162

Class

ImageWidgetCropTest
Minimal test case for the image_widget_crop module.

Namespace

Drupal\Tests\image_widget_crop\FunctionalJavascript

Code

protected function getButtonName($xpath) {
  $retval = '';

  /** @var \SimpleXMLElement[] $elements */
  if ($elements = $this
    ->xpath($xpath)) {
    foreach ($elements[0]
      ->attributes() as $name => $value) {
      if ($name == 'name') {
        $retval = (string) $value;
        break;
      }
    }
  }
  return $retval;
}