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
$results = db_select('flood')->fields(NULL, array('expiration'))->execute()->fetchAll(); | |
$count = count($results); | |
dpm($count); | |
db_delete('flood') | |
->execute(); | |
$results = db_select('flood')->fields(NULL, array('expiration'))->execute()->fetchAll(); | |
$count = count($results); | |
dpm($count); |
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
default: | |
formatters: | |
defaultFormat: | |
name: 'progress' |
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'; | |
} | |
} |
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
<?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
$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
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
$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
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
$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); | |
} |