This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sets an iFrame ID to no_name_iframe if there is no ID. You can then add a Switch to iFrame step after it using the na_name_iframe ID. | |
* | |
* @Given /^I the set the iframe located in element with an id of "([^"]*)"$/ | |
*/ | |
public function iSetTheIframeLocatedInElementWithAnIdOf($element_id) { | |
$check = 1; //@todo need to check using js if exists | |
if($check <= 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Some forms do not have a Submit button just pass the ID | |
* | |
* @Given /^I submit the form with id "([^"]*)"$/ | |
*/ | |
public function iSubmitTheFormWithId($arg) | |
{ | |
$node = $this->getMainContext()->getSession()->getPage()->find('css', $arg); | |
if($node) { | |
$this->getMainContext()->getSession()->executeScript("jQuery('$arg').submit();"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @hidden | |
* | |
* @Then /^I click on the alert window$/ | |
*/ | |
public function iClickOnTheAlertWindow() { | |
$this->getMainContext()->getSession()->getDriver()->getWebDriverSession()->accept_alert(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @hidden | |
* | |
* @Then /^I switch to popup by clicking "([^"]*)"$/ | |
*/ | |
public function iSwitchToPopupByClicking($arg1) { | |
$originalWindowName = $this->getMainContext()->getSession()->getWindowName(); | |
$this->setMainWindow(); | |
$this->getMainContext()->getSession()->getPage()->clickLink("$arg1"); //Pressing the withdraw button |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* See if the element (name|label|id) is greater than the % of the window | |
* | |
* @Then /^the element "([^"]*)" should be "([^"]*)" percent or greater than the window$/ | |
*/ | |
public function theElementShouldBePercentOrGreaterThanTheWindow($arg1, $arg2) | |
{ | |
//@todo | |
$javascript_check = <<<HEREDOC | |
if(!jQuery('$arg1').length) { return "FAILED"; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Ajax Example' | |
description: 'Just an Ajax Example' | |
core: 8.x | |
type: module |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @Then /^I fill in wysiwyg on field "([^"]*)" with "([^"]*)"$/ | |
*/ | |
public function iFillInWysiwygOnFieldWith($arg, $arg2) | |
{ | |
$this->getSession()->executeScript("CKEDITOR.instances.$arg.setData(\"$arg2\");"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_inline_entity_form_table_fields_alter(). | |
*/ | |
function MODULE_inline_entity_form_table_fields_alter(&$fields, $context) { | |
if ($context['parent_bundle'] === 'MODULE' && | |
$context['entity_type'] === 'MODULE_text_asset') { | |
// Remove Title. | |
unset($fields['id']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = \Drupal::service('path.alias_manager')->getPathByAlias('/this-is-the-alias'); | |
if(preg_match('/node\/(\d+)/', $path, $matches)) { | |
$node = \Drupal\node\Entity\Node::load($matches[1]); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\file\Entity\File; | |
use Drupal\image\Entity\ImageStyle; | |
// File ID. | |
$fid = 123; | |
// Load file. | |
$file = File::load($fid); | |
// Get origin image URI. | |
$image_uri = $file->getFileUri(); | |
// Load image style "thumbnail". |