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
/** | |
* Adds a new step to a course | |
* @param $course_id NID of the Course Node to add the step to | |
* @param $step_node_id NID of the node to add as a step | |
*/ | |
function my_module_add_existing_step_to_course($course_id, $step_node_id) { | |
$node = node_load($course_id); | |
$course = course_get_course($node); | |
$new_weight = count($course->getObjects()); |
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
public function afterScenario($event) { | |
if ($event->getResult()) { | |
$this->recordFailedEvent($event); | |
} | |
parent::afterScenario($event); | |
} | |
public function recordFailedEvent($event) { | |
$fileName = $this->timestamp; |
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
$vocab_name = ''; | |
$vocab_id = taxonomy_vocabulary_machine_name_load($vocab_name)->vid; | |
dpm($vocab_id); | |
$tids = array(); | |
foreach (taxonomy_get_tree($vocab_id) as $term) { | |
taxonomy_term_delete($term->tid); | |
} |
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
echo .DS_Store > ~/.gitignore_global | |
git config --global core.excludesfile ~/.gitignore_global |
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
$form['my_field']['#states'] = array( | |
'visible' => array( | |
array( | |
array(':input[name="field_other[und]"]' => array('value' => 'first')), | |
'or', | |
array(':input[name="field_other[und]"]' => array('value' => 'second')), | |
), | |
), | |
); |
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
public function recordFailedEvent($event) { | |
$fileName = $this->timestamp; | |
// TODO: Make this a setting in behat.yml? | |
$html_dump_path = 'failures'; | |
$message = ''; | |
$session = $this->getSession(); | |
$page = $session->getPage(); | |
$driver = $session->getDriver(); | |
$date = date('Y-m-d H:i:s'); |
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
$entity_type = 'node'; | |
$bundle = 'article'; | |
$query = new EntityFieldQuery(); | |
$query->entityCondition('entity_type', $entity_type) | |
->entityCondition('bundle', $bundle); | |
$result = $query->execute(); | |
if (isset($result[$entity_type])) { | |
$ids = array_keys($result[$entity_type]); |
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 Behat\MinkExtension\Context\RawMinkContext, | |
Behat\Behat\Hook\Scope\AfterScenarioScope; | |
/** | |
* Defines application features from the specific context. | |
*/ | |
class FailureHtmlDumpContext extends RawMinkContext { | |
/** |
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
public function iPublishAllNodes($content_type) { | |
$query = new EntityFieldQuery(); | |
$query->entityCondition('entity_type', 'node') | |
->entityCondition('bundle', $content_type); | |
$result = $query->execute(); | |
if (isset($result['node'])) { | |
$nids = array_keys($result['node']); | |
$nodes = node_load_multiple($nids); | |
foreach ($nodes as $node) { | |
$node->status = 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
/** | |
* Implements hook_facetapi_facet_info_alter(). | |
*/ | |
function hook_facetapi_facet_info_alter(array &$facet_info, array $searcher_info) { | |
foreach ($facet_info as $name => $facet) { | |
$name = 'field_parent'; | |
if ($name == $name) { | |
$facet_info[$name]['hierarchy callback'] = 'hook_facets_entity_reference_hierarchy'; | |
} | |
} |
OlderNewer