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
To quickly start with a new custom module is can be convenient to copy an exisiting. But you then need a quick way to rename files, folders and string within files. | |
##Rename files and folders | |
Look for files that contain STRINGTOLOOKFOR in name: | |
`find . -name "STRINGTOLOOKFOR*" -exec rename -v 's/STRINGTOLOOKFOR/STRINGTOREPLACEWITH/i' {} \;` | |
For example: | |
`find . -name "bcca_tools*" -exec rename -v 's/bcca_tools/project_tools/i' {} \;` |
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
127.0.0.1 dae.dev.europa.eu dae | |
127.0.0.1 dae1.dev.europa.eu dae1 | |
127.0.0.1 dae2.dev.europa.eu dae2 | |
127.0.0.1 platform.dev.europa.eu platform | |
127.0.0.1 d8.dev.europa.eu d8 | |
127.0.0.1 d7.dev.europa.eu d7 | |
127.0.0.1 .dev.europa.eu | |
127.0.0.1 dae3.dev.europa.eu dae3 | |
127.0.0.1 dae4.dev.europa.eu dae4 | |
127.0.0.1 dae5.dev.europa.eu dae5 |
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
// ==UserScript== | |
// @name Hide annoying content | |
// @namespace hide-annoyance | |
// @version 0.1 | |
// @description Hide annoying content | |
// @author boris | |
// @match http*://*.europa.eu/* | |
// @grant none | |
// ==/UserScript== |
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
/** | |
* Create vocabulary and terms for Topic. | |
*/ | |
function _g2m_initiative_create_taxonomies() { | |
// Defines taxonomies to be created. | |
$taxonomies = array( | |
'g2m_topics' => array( | |
'name' => t('Topics'), | |
'terms' => array(), |
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
/home/cnect/www/digital-agenda-dev/bin/phpcs --standard=Drupal --extensions='php,module,inc,install,test,profile,theme,js,css,info,txt' modules/features/custom/cnect_ex |
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
// Disable obsolete menu modules. | |
$modules = array('menu_token', 'menu_attributes'); | |
foreach ($modules as $module) { | |
if (module_exists($module)) { | |
module_disable(array($module), TRUE); | |
drupal_uninstall_modules(array($module)); | |
} | |
} |
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
/** | |
* UNLOCK the field provided so we can tweak settings. | |
*/ | |
function nexteuropa_map_update_7002() { | |
$field = field_read_field('map_layers'); | |
$field['locked'] = FALSE; | |
field_update_field($field); | |
} |
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
/** | |
* Delete field | |
*/ | |
function mymodule_update_7000() { | |
$fields = array( | |
'field_myfield1', | |
'field_myfield2', | |
); | |
foreach ($fields as $field) { | |
if ($instance = field_info_instance('node', $field, 'page')) { |
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
/** | |
* Deletes obsolete fields. | |
*/ | |
function generic_project_update_7000() { | |
$fields = array( | |
'field_gp_country', | |
'field_gp_description', | |
'field_gp_location', | |
'field_gp_project_manager', | |
'gp_project_manager', |
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
// Imports country flags. | |
$machine_name = 'EUCountries'; | |
migrate_static_registration(array($machine_name)); | |
$migration = Migration::getInstance($machine_name); | |
$migration->prepareUpdate(); | |
$result = $migration->processImport(); | |