protected function InlineEntityFormTestBase::getButtonName in Inline Entity Form 8
Gets IEF button name.
Parameters
string $xpath: Xpath of the button.
Return value
string The name of the button.
File
- tests/src/ FunctionalJavascript/ InlineEntityFormTestBase.php, line 68 
Class
- InlineEntityFormTestBase
- Base Class for Inline Entity Form Tests.
Namespace
Drupal\Tests\inline_entity_form\FunctionalJavascriptCode
protected function getButtonName(string $xpath) {
  $retval = '';
  /** @var \SimpleXMLElement[] $elements */
  if ($elements = $this
    ->xpath($xpath)) {
    foreach ($elements[0]
      ->attributes() as $name => $value) {
      if ($name === 'name') {
        $retval = $value;
        break;
      }
    }
  }
  return $retval;
}