Commit 3944b065 authored by borisson_'s avatar borisson_ Committed by bojanz

Issue #2775959 by borisson_: PHPCS code style fixes

parent 263050c9
<?php
/**
* @file
* Views integration for Commerce.
*/
use Drupal\Core\Entity\ContentEntityType;
/**
* Implements hook_views_data_alter().
*/
......@@ -7,7 +14,7 @@ function commerce_views_data_alter(array &$data) {
// Override the bundle views handlers for commerce content entities.
$entity_types = \Drupal::service('entity_type.manager')->getDefinitions();
foreach ($entity_types as $entity_type) {
if ($entity_type instanceof \Drupal\Core\Entity\ContentEntityType && strpos($entity_type->id(), 'commerce_') === 0) {
if ($entity_type instanceof ContentEntityType && strpos($entity_type->id(), 'commerce_') === 0) {
// Translatable entities have a data table. Non-translatable ones
// (such as Order) have only a base table.
if ($data_table = $entity_type->getDataTable()) {
......
<?php
/**
* @file
* Contains install and update functions for Price.
*/
/**
* Implements hook_requirements().
*
* Check that the Commerce Guys' Libraries have been installed.
*/
function commerce_price_requirements($phase) {
$requirements = [];
if ($phase == 'install') {
if (!class_exists('\CommerceGuys\Intl\Currency\CurrencyRepository')) {
$requirements['commerce_price_library'] = [
......
......@@ -5,6 +5,7 @@
* Defines the Product entity and associated features.
*/
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Cache\Cache;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
......@@ -47,7 +48,7 @@ function commerce_product_entity_form_display_update(EntityFormDisplayInterface
/**
* Implements hook_ENTITY_TYPE_update().
*/
function commerce_product_entity_view_display_update(Drupal\Core\Entity\EntityInterface $entity) {
function commerce_product_entity_view_display_update(EntityInterface $entity) {
// The product view uses the variation view and needs to be cleared, which doesn't happen automatically
// because we're editing the variation, not the product
if (substr($entity->getConfigTarget(), 0, 27) === 'commerce_product_variation.') {
......@@ -63,13 +64,13 @@ function commerce_product_entity_access(EntityInterface $entity, $operation, $ac
// @todo Remove once we implement the full product permissions.
if ($operation == 'view') {
if ($entity->getEntityTypeId() == 'commerce_product' && $entity->isPublished()) {
return \Drupal\Core\Access\AccessResult::allowed();
return AccessResult::allowed();
}
elseif ($entity->getEntityTypeId() == 'commerce_product_variation' && $entity->isActive()) {
return \Drupal\Core\Access\AccessResult::allowed();
return AccessResult::allowed();
}
}
return \Drupal\Core\Access\AccessResult::neutral();
return AccessResult::neutral();
}
/**
......
......@@ -31,7 +31,7 @@ function commerce_tax_entity_base_field_info(EntityTypeInterface $entity_type) {
->setLabel(t('Tax registrations'))
->setDescription(t('The countries where the store is additionally registered to collect taxes.'))
->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
->setSetting('allowed_values_function', ['\Drupal\commerce_store\Entity\Store','getAvailableCountries'])
->setSetting('allowed_values_function', ['\Drupal\commerce_store\Entity\Store', 'getAvailableCountries'])
->setDisplayOptions('form', [
'type' => 'options_select',
'weight' => 4,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment