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
| \Drupal::service('entity.definition_update_manager')->applyUpdates(); |
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
| $f = \Drupal::entityTypeManager()->getStorage('fee_item')->load(42); | |
| $f->set('default_sum', 0); | |
| $f->setNewRevision(TRUE); | |
| $f->revision_log = t('Display fee item in list2.'); | |
| $f->setRevisionCreationTime(REQUEST_TIME); | |
| $f->setRevisionUserId(1); | |
| $f->save(); |
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\node\Plugin\views\argument_default; | |
| use Drupal\Core\Cache\Cache; | |
| use Drupal\Core\Cache\CacheableDependencyInterface; | |
| use Drupal\Core\Routing\RouteMatchInterface; | |
| use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase; | |
| use Drupal\node\NodeInterface; | |
| 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
| use Drupal\commerce_cart\CartManagerInterface; | |
| $store = \Drupal\commerce_store\Entity\Store::load(1); | |
| $cart =\Drupal::service('commerce_cart.cart_provider')->getCart('default', $store); | |
| $cart->delete(); | |
| \Drupal::service('commerce_cart.cart_manager')->emptyCart($cart, TRUE); |
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\Core\Database\Database; | |
| $connection_info = Database::getConnectionInfo('default'); | |
| $db = $connection_info['default']['database']; | |
| $u = $connection_info['default']['username']; | |
| $p = $connection_info['default']['password']; | |
| $current_date = date('Y-m-d_H-i-s'); | |
| $command = "mysqldump --user=$u --password=$p $db"; | |
| $dump = shell_exec($command); |
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
| $post_codes_base_link = ''; | |
| $post_code_description = $this->house->get('field_postcode')->getDataDefinition()->getDescription(); | |
| if (UrlHelper::isValid($post_code_description, TRUE)) { | |
| $post_codes_base_url = \Drupal\Core\Url::fromUri($post_code_description); | |
| $post_codes_base_url->setOptions(['attributes' => ['target' => 'blank']]); | |
| $post_codes_base_link = \Drupal\Core\Link::fromTextAndUrl( | |
| t('Lithuania postcodes base'), | |
| $post_codes_base_url | |
| ); | |
| } |
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
| /** | |
| * Get currency symbol. | |
| * | |
| * @param object $product_variation | |
| * @return string | |
| */ | |
| public function getCurrencySymbol($product_variation) { | |
| $currency_code = $product_variation->get('price')->currency_code; | |
| $currency = Currency::load($currency_code); |
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
| drush ev "echo drupal_get_installed_schema_version('bendrijusistema')"; | |
| drupal_set_installed_schema_version('bendrijusistema', 8001); | |
| drupal_get_installed_schema_version('bendrijusistema'); |
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_entity_info_alter(). | |
| */ | |
| function cba_webinar_entity_info_alter(&$entity_info) { | |
| // Update webinar event path. | |
| $entity_info['event']['bundles']['webinar']['crud']['add']['path'] = 'event/webinar/add'; | |
| $entity_info['event']['bundles']['webinar']['crud']['edit']['path'] = 'event/webinar/%eckentity/edit'; | |
| $entity_info['event']['bundles']['webinar']['crud']['delete']['path'] = 'event/webinar/%eckentity/delete'; | |
| } |
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
| Drupal.behaviors.security_questions_popup = { | |
| attach: function(context, settings) { | |
| var need_add_questions = Drupal.settings.global.need_add_security_questions; | |
| if (need_add_questions) { | |
| $(window).bind('load', function() { | |
| $('.security_questions_hide_link').click(); | |
| }); | |
| } | |
| } |