This file contains 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
/** | |
* @Then I fill in wysiwyg on field :locator with :value | |
*/ | |
public function iFillInWysiwygOnFieldWith($locator, $value) { | |
$el = $this->getSession()->getPage()->findField($locator); | |
if (empty($el)) { | |
throw new ExpectationException('Could not find WYSIWYG with locator: ' . $locator, $this->getSession()); | |
} |
This file contains 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
/** | |
* Rebuild node access permissions. | |
* node_access_rebuild(TRUE) claims to be able to do this in batch mode but all it does is set a | |
* batch. There is no way to process the batch from within an update hook. You could do it using | |
* a separate drush command but if you only have access to run updb on your production env | |
* then you need to do all the processing from within the update hook. This gem allows complete | |
* safe permission rebuild, batched, from within a single update hook. | |
*/ | |
function mymodule_update_7001(&$sandbox) { | |
_node_access_rebuild_batch_operation($sandbox); |
This file contains 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
/** | |
* @When I fill in the autocomplete :autocomplete with :text and click :popup | |
*/ | |
public function fillInDrupalAutocomplete($autocomplete, $text, $popup) { | |
$el = $this->getSession()->getPage()->findField($autocomplete); | |
$el->focus(); | |
// Set the autocomplete text then put a space at the end which triggers | |
// the JS to go do the autocomplete stuff. | |
$el->setValue($text); |
This file contains 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_form_FORM_ID_alter(). | |
*/ | |
function mymodule_form_file_entity_add_upload_alter(&$form) { | |
_mymodule_media_form_alter($form); | |
} | |
/** | |
* Implements hook_form_FORM_ID_alter(). | |
*/ |
This file contains 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
/** | |
* Move all data in one field to another. | |
* In the example below we replace a multi cardinality field (field_old_field) | |
* with a single cardinality field (field_new_field). | |
* The data in the first element of the old field becomes the only data in the new field. | |
* | |
* @requires entity module | |
*/ | |
function mymodule_update_7001(&$sandbox) { | |
if (!isset($sandbox['progress'])) { |
This file contains 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
/** | |
* Masquerade block in the Navbar Region. | |
*/ | |
#masquerade-block-1 div#autocomplete ul { | |
padding-top: 3px; | |
float: left; | |
width: 300px !important; | |
margin-top: 30px; | |
position: absolute; |
This file contains 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 | |
/** | |
* @file | |
* sites/all/drush/play.drush.php | |
* | |
* Oftentimes one needs to run an operation on a list of things. | |
* If this list is of variable length, running it in one process may | |
* cause a time out and/or out of memory. | |
* |
This file contains 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 | |
function drupal_run_as($user, $func) { | |
global $user; | |
$original_user = $user; | |
$old_state = drupal_save_session(); | |
drupal_save_session(FALSE); | |
$args = func_get_args(); | |
$user = array_shift($args); |
This file contains 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 | |
/** | |
* @file | |
* | |
* Add this code in a file features/bootstrap/PersonaContext.php | |
* | |
* Include the PersonaContext in behat.yml like this ... | |
* | |
* default: |
NewerOlder