Pathauto and dependencies

This commit is contained in:
Rob Davies 2017-05-22 15:12:47 +01:00
parent 4b1a293d57
commit 24ffcb956b
257 changed files with 29510 additions and 0 deletions

View file

@ -0,0 +1,6 @@
id: token_module_test
label: 'Token test'
status: true
langcode: en
locked: true
pattern: Y

View file

@ -0,0 +1,37 @@
<?php
namespace Drupal\token_module_test\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\Request;
class TokenTreeBrowseController extends ControllerBase {
/**
* Page callback to output a link.
*/
function outputLink(Request $request) {
$build['tree']['#theme'] = 'token_tree_link';
$build['tokenarea'] = [
'#markup' => \Drupal::token()->replace('[current-page:title]'),
'#type' => 'markup',
];
return $build;
}
/**
* Title callback for the page outputting a link.
*
* We are using a title callback instead of directly defining the title in the
* routing YML file. This is so that we could return an array instead of a
* simple string. This allows us to test if [current-page:title] works with
* render arrays and other objects as titles.
*/
public function getTitle() {
return [
'#type' => 'markup',
'#markup' => 'Available Tokens',
];
}
}

View file

@ -0,0 +1,12 @@
type: module
name: Token Module Test
description: Testing module for token functionality.
package: Testing
# core: 8.x
hidden: TRUE
# Information added by Drupal.org packaging script on 2017-04-29
version: '8.x-1.0'
core: '8.x'
project: 'token'
datestamp: 1493466847

View file

@ -0,0 +1,32 @@
<?php
/**
* @file
* Helper module for token tests.
*/
use Drupal\node\NodeInterface;
/**
* Implements hook_page_attachments().
*/
function token_module_test_page_attachments() {
if ($debug = \Drupal::state()->get('token_page_tokens', array())) {
$debug += array('tokens' => array(), 'data' => array(), 'options' => array());
foreach (array_keys($debug['tokens']) as $token) {
$debug['values'][$token] = \Drupal::token()->replace($token, $debug['data'], $debug['options']);
}
\Drupal::state()->set('token_page_tokens', $debug);
}
}
/**
* Implements hook_ENTITY_TYPE_presave for Node entities.
*/
function token_module_test_node_presave(NodeInterface $node) {
// Transform tokens in the body.
// @see \Drupal\token\Tests\TokenMenuTest::testMenuTokens()
if ($node->hasField('body')) {
$node->body->value = \Drupal::token()
->replace($node->body->value, ['node' => $node]);
}
}

View file

@ -0,0 +1,7 @@
token_module_test.browse:
path: '/token_module_test/browse'
defaults:
_controller: '\Drupal\token_module_test\Controller\TokenTreeBrowseController::outputLink'
_title_callback: '\Drupal\token_module_test\Controller\TokenTreeBrowseController::getTitle'
requirements:
_access: 'TRUE'

View file

@ -0,0 +1,13 @@
<?php
/**
* Implements hook_token_info()
*/
function token_module_test_token_info() {
$info['tokens']['node']['colons:in:name'] = array(
'name' => t('A test token with colons in the name'),
'description' => NULL,
);
return $info;
}

View file

@ -0,0 +1,23 @@
langcode: de
status: true
dependencies:
module:
- image
- user
id: user.user.default
targetEntityType: user
bundle: user
mode: default
content:
account:
weight: -10
user_picture:
type: image_image
settings:
progress_indicator: throbber
preview_image_style: thumbnail
third_party_settings: { }
weight: -1
timezone:
weight: 6
hidden: { }

View file

@ -0,0 +1,31 @@
id: user.user.user_picture
status: true
langcode: en
entity_type: user
bundle: user
field_name: user_picture
label: Picture
description: 'Your virtual face or picture.'
required: false
default_value: { }
default_value_function: ''
settings:
file_extensions: 'png gif jpg jpeg'
file_directory: pictures
max_filesize: '30 KB'
alt_field: false
title_field: false
max_resolution: 85x85
min_resolution: ''
default_image:
uuid: null
alt: ''
title: ''
width: null
height: null
alt_field_required: false
title_field_required: false
field_type: image
dependencies:
config:
- field.storage.user.user_picture

View file

@ -0,0 +1,25 @@
id: user.user_picture
status: true
langcode: en
field_name: user_picture
entity_type: user
type: image
settings:
uri_scheme: public
default_image:
uuid: null
alt: ''
title: ''
width: null
height: null
module: image
locked: false
cardinality: 1
translatable: false
indexes:
target_id:
- target_id
dependencies:
module:
- image
- user

View file

@ -0,0 +1,14 @@
type: module
name: Token User picture
description: Testing module that provides user pictures field.
package: Testing
# core: 8.x
hidden: TRUE
dependencies:
- image
# Information added by Drupal.org packaging script on 2017-04-29
version: '8.x-1.0'
core: '8.x'
project: 'token'
datestamp: 1493466847