Commit 42d1a5da authored by bojanz's avatar bojanz

Add forgotten commerce_store.module file.

parent 070d8d1d
<?php
/**
* @file
* Defines the Store entity and associated features.
*/
use Drupal\Core\Form\FormStateInterface;
/**
* Gets the allowed values for the 'countries' base field.
*
* @return array
* The allowed values.
*/
function commerce_store_available_countries() {
// @todo Move this to a static method on the Store entity class once
// core fixes the invokation of available_values_function.
return \Drupal::service('address.country_repository')->getList();
}
function commerce_store_field_widget_form_alter(&$element, FormStateInterface $form_state, $context) {
$field_definition = $context['items']->getFieldDefinition();
$field_name = $field_definition->getName();
$entity_type = $field_definition->getTargetEntityTypeId();
$widget_name = $context['widget']->getPluginId();
if ($field_name == 'countries' && $entity_type == 'commerce_store' && $widget_name == 'options_select') {
$element['#options']['_none'] = t('Sell to all countries');
$element['#size'] = 5;
}
}
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