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
/** | |
* Update taxonomy term. | |
*/ | |
function _zk_general_test() { | |
$query = \Drupal::database()->update('taxonomy_term_field_data'); | |
$query->fields([ | |
'description__format' => 'plain_text', | |
]); | |
$query->condition('vid', 'sectors'); | |
$query->execute(); |
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
MacBook-Pro:drupal-vm jim$ vagrant reload --provision | |
==> drupalvm: [vagrant-hostsupdater] Removing hosts | |
Password: | |
==> drupalvm: Attempting graceful shutdown of VM... | |
==> drupalvm: Checking if box 'geerlingguy/ubuntu1604' is up to date... | |
==> drupalvm: Clearing any previously set forwarded ports... | |
==> drupalvm: Clearing any previously set network interfaces... | |
==> drupalvm: Preparing network interfaces based on configuration... | |
drupalvm: Adapter 1: nat | |
drupalvm: Adapter 2: hostonly |
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
# drop db, create db, import db | |
mysql -uroot -proot -D -e "DROP DATABASE mydatabase";mysql -uroot -proot -D -e "CREATE DATABASE mydatabase";mysql -uroot -proot mydatabase < mydatabase.sql | |
# drop db, create db, unzip db, import db | |
mysql -uroot -proot -D -e "DROP DATABASE mydatabase";mysql -uroot -proot -D -e "CREATE DATABASE mydatabase";gunzip mydatabase.sql.gz | mysql -uroot -proot mydatabase < mydatabase.sql |
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['interval'] = [ | |
'#type' => 'textfield', | |
'#title' => $this->t('Reactivation interval'), | |
'#description' => $this->t(''), | |
'#maxlength' => 64, | |
'#size' => 64, | |
'#default_value' => $config->get('interval'), | |
'#suffix' => "<div class='description' id='human-interval'></div>", | |
'#description'=> $this->('Period after which account must be reactivated. Must be entered in days.'), | |
'#attached' => [ |
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
$field_name = 'field_name'; | |
$field = field_read_field($field_name); | |
$field['locked'] = 0; // 0: unlock; 1: lock. | |
field_update_field($field); |
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
/** | |
* Deletes obsolete contexts. | |
*/ | |
function mymodule_update_7132() { | |
$disable = array( | |
'single_telecom_market_news', | |
'oi24u_community', | |
'dae_side_blocks', | |
); |
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
$contexts = variable_get('context_status', array()); | |
$disable = array('homepage','sitewide','dae_search_empty','webmasters','no_twitter','workbench_moderate_all','go-to-market','newsroom_events','communities_audence_link','digital_champion_newsroom','grand_coalition_pledge','workbench_moderate_all'); | |
foreach($disable as $item) { | |
$contexts[$item] = TRUE; | |
} | |
variable_set('context_status', $contexts); |
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
// Enable flexslider modules. | |
$modules = array( | |
'flexslider', | |
'flexslider_fields', | |
'flexslider_views', | |
'flexslider_views_slideshow', | |
); | |
module_enable($modules); |
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
$result = db_query("SELECT * from system where name = 'best_practice_db'"); | |
debug($result->fetchObject()); |
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
use Drupal\node\Entity\Node; | |
function _svv_tools_set_author() { | |
$user = user_load_by_name('test'); | |
$query = \Drupal::entityQuery('node'); | |
$nids = $query->execute(); | |
dd($nids); | |
foreach ($nids as $nid) { | |
$node = Node::load($nid); | |
$node->uid->value = $user->id(); |
NewerOlder