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
| 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
| 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
| <?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
| $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
| \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
| <?php | |
| use Drupal\Core\Database\Database; | |
| use Drupal\group_revision\GroupRevisionTrait; | |
| /** | |
| * Implements hook_install(). | |
| */ | |
| function group_revision_install() { | |
| // Update entity fields. |
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 static function getMonthInterval($date) { | |
| $month_interval = []; | |
| // Get start month date. | |
| $date_obj = new \DateTime($date); | |
| $date_obj->modify('first day of this month'); | |
| $month_interval['start'] = $date_obj->getTimestamp(); | |
| // Get end month date. | |
| $date_obj->modify('last day of this month'); |
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_update_manager = \Drupal::entityDefinitionUpdateManager(); | |
| $entity_type = $entity_update_manager->getEntityType('bs_mail_logger'); | |
| $entity_update_manager->uninstallEntityType($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
| $output['#attached']['library'][] = 'core/drupal.dialog.ajax'; |