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
<?php | |
namespace Drupal\gojara_activity_results\Plugin\views\field; | |
use Drupal\Component\Serialization\Json; | |
use Drupal\Core\Link; | |
use Drupal\Core\Url; | |
use Drupal\views\Plugin\views\field\FieldPluginBase; | |
use Drupal\views\ResultRow; |
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
/** | |
* Implements hook_query_TAG_alter() for comments. | |
* | |
* @see CommentStorage::loadThread(). | |
*/ | |
function gojara_global_query_comment_filter_alter(AlterableInterface $query) { | |
// Sort comments by rating and leave default sorting for threads. | |
if ($query->getMetaData('field_name') === 'comment') { | |
$order_by = &$query->getOrderBy(); | |
$expression = &$query->getExpressions(); |
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
{% for attribute_data in order_item.getPurchasedEntity().getAttributeValues() %} | |
<tr> | |
<td align="left" valign="top" class="product-attr" style="color: #000000; font-family: 'Nunito Sans', sans-serif; font-weight: 400; font-size: 14px; line-height: 22px;">{{ attribute_data.getAttribute().label() }}: {{ attribute_data.label() }}</td> | |
</tr> | |
{% endfor %} |
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
<?php | |
namespace Drupal\swimsports_commerce\Plugin\Condition; | |
use Drupal\Core\Condition\ConditionPluginBase; | |
use Drupal\Core\Entity\EntityStorageInterface; | |
use Drupal\Core\Form\FormStateInterface; | |
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | |
use Symfony\Component\DependencyInjection\ContainerInterface; |
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
/** | |
* Implements hook_ENTITY_TYPE_view_alter() for 'commerce_product' entities. | |
*/ | |
function swimsports_commerce_commerce_product_view_alter(array &$build, EntityInterface $node, EntityViewDisplayInterface $display) { | |
// Hide price field. For some reason we cannot configure price visibility | |
// from UI. | |
if ($build['#view_mode'] === 'add_to_cart_confirmation_view') { | |
$build['variation_price']['#access'] = FALSE; | |
} | |
} |
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
$view = Views::getView('related_products'); | |
$view->setDisplay('default'); | |
$view->removeHandler('default', 'header', 'area'); | |
$view_render_info = $view->render(); | |
$build['related_products_carusel'] = [ | |
'#markup' => \Drupal::service('renderer')->render($view_render_info), | |
]; |
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
Ubuntu 19.10 don't have official Docker support so should add it manually: | |
Add docker repository: | |
sudo add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
disco \ | |
stable" | |
Update packages: | |
sudo apt-get update |
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
$comment = $form_state->getFormObject()->getEntity(); | |
$submission = $comment->getCommentedEntity(); |
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
$group = NULL; | |
foreach ($view->argument as $arg) { | |
if ($arg->getPluginId() !== 'group_id') { | |
continue; | |
} | |
$group = Group::load($arg->getValue()); | |
break; | |
} |
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
$index = search_api_index_load('index_name'); | |
$query = new SearchApiQuery($index); | |
$query->condition('type', 'blog', '='); | |
$results = $query->execute(); |
NewerOlder