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
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: mongodb-0 | |
labels: | |
app.kubernetes.io/name: mongodb | |
app.kubernetes.io/component: mongodb | |
spec: | |
type: ClusterIP | |
clusterIP: None |
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
nodes: | |
- address: master.my-domain.com | |
user: my-user | |
role: | |
- controlplane | |
- etcd | |
- address: worker1.my-domain.com | |
user: my-user | |
role: | |
- worker |
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 | |
function get_eu_countries() { | |
$countries = []; | |
$countries['AT'] = ['name' => 'Austria',]; | |
$countries['BE'] = ['name' => 'Belgium',]; | |
$countries['BG'] = ['name' => 'Bulgaria',]; | |
$countries['CY'] = ['name' => 'Cyprus',]; | |
$countries['CZ'] = ['name' => 'Czech Republic',]; | |
$countries['DE'] = ['name' => 'Germany',]; |
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 | |
// All these are found in core/includes/schema.inc | |
// Get schema version for your module. | |
drupal_get_installed_schema_version('MY_MODULE'); | |
// schema version number is N in hook_update_N | |
drupal_set_installed_schema_version('MY_MODULE', 'Schema_version_number'); | |
// Get all schema versions for all 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
<?php | |
/** | |
*The numbers are normally composed of three parts: | |
* - 1 or 2 digits for Drupal core compatibility (Drupal 8, 9, 10, etc.). This | |
* convention must be followed. | |
* - 1 digit for your module's major release version; for example, for 8.x-1.* | |
* use 1, for 8.x-2.* use 2, for Core 8.0.x use 0, and for Core 8.1.x use 1. | |
* This convention is optional but suggested for clarity. |
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 | |
function hook_MY_MODULE_form_alter(){ | |
// Altering the actions available for a node form, either add or edit. | |
$build_info = $form_state->getBuildInfo(); | |
if (isset($build_info['base_form_id']) && $build_info['base_form_id'] == 'node_form') { | |
$form_object = $form_state->getFormObject(); | |
$entity = $form_object->getEntity(); | |
$bundle = $entity->bundle(); |
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
SELECT | |
table_schema AS `Database`, | |
table_name AS `Table`, | |
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` | |
FROM information_schema.TABLES WHERE table_schema = 'exampledb' | |
ORDER BY (data_length + index_length) DESC | |
LIMIT 10; |
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 | |
$nodes = node_load_multiple(array(), array('type' => $type)); | |
foreach($nodes as $nid => $node){ | |
// Comment status : | |
// 2 - open | |
// 1 - closed | |
// 0 - hidden | |
$node->comment = 1; | |
node_save($node); |
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 | |
namespace Drupal\commerce_price\Plugin\Commerce\Condition; | |
use Drupal\commerce\Plugin\Commerce\Condition\ConditionBase; | |
use Drupal\Core\Entity\EntityInterface; | |
use Drupal\Core\Entity\EntityTypeManagerInterface; | |
use Drupal\Core\Form\FormStateInterface; | |
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | |
use Symfony\Component\DependencyInjection\ContainerInterface; |
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
#When a slug passed in route doesn't load entity on getParameter, you need to pass the entity type as options | |
#in routing.yml so that the entityconverter knows what it is. | |
#@link https://www.drupal.org/docs/8/api/routing-system/how-a-node-id-gets-converted-to-its-actual-node-object | |
#in your routing.yml | |
route_name: | |
path: /path/{foo} | |
options: | |
parameters: |