Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176

This commit is contained in:
Pantheon Automation 2015-08-17 17:00:26 -07:00 committed by Greg Anderson
commit 9921556621
13277 changed files with 1459781 additions and 0 deletions

View file

@ -0,0 +1,6 @@
name: 'Options test'
type: module
description: 'Support module for the Options module tests.'
core: 8.x
package: Testing
version: VERSION

View file

@ -0,0 +1,56 @@
<?php
/**
* @file
* Helper module for the List module tests.
*/
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
/**
* Implements callback_allowed_values_function().
*
* @see options_allowed_values().
*/
function options_test_allowed_values_callback(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL) {
$values = array(
'Group 1' => array(
0 => 'Zero',
),
1 => 'One',
'Group 2' => array(
2 => 'Some <script>dangerous</script> & unescaped <strong>markup</strong>',
),
'More <script>dangerous</script> markup' => array(
3 => 'Three',
),
);
return $values;
}
/**
* Implements callback_allowed_values_function().
*
* @todo This function violates the recommendation in options_allowed_values()
* to return a list of all possible values in any context when $items is
* NULL. Since this is not yet used for testing Views integration, that is
* alright for now. Fix this in https://www.drupal.org/node/2012130.
*
* @see options_allowed_values().
*/
function options_test_dynamic_values_callback(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL, &$cacheable = NULL) {
$values = array();
if (isset($entity)) {
$cacheable = FALSE;
$values = array(
$entity->label(),
$entity->url(),
$entity->uuid(),
$entity->bundle(),
);
}
// We need the values of the entity as keys.
return array_combine($values, $values);
}