You are here

protected function ImageWidgetCropTest::getButtonName in Image Widget Crop 8

Gets IEF button name.

Parameters

string $xpath: Xpath of the button.

Return value

string The name of the button.

2 calls to ImageWidgetCropTest::getButtonName()
ImageWidgetCropTest::testCropUi in src/Tests/ImageWidgetCropTest.php
Test Image Widget Crop UI.
ImageWidgetCropTest::testImageWidgetCrop in src/Tests/ImageWidgetCropTest.php
Test Image Widget Crop.

File

src/Tests/ImageWidgetCropTest.php, line 212

Class

ImageWidgetCropTest
Minimal test case for the image_widget_crop module.

Namespace

Drupal\image_widget_crop\Tests

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;
}