Issue #1970206 by andypost, swentel: Move fields and instances to standard profile config.

8.0.x
Alex Pott 2013-04-18 08:08:18 +01:00
parent 6fa5b693be
commit 0cc0335638
9 changed files with 154 additions and 119 deletions

View File

@ -1,5 +1,4 @@
id: field_test_import
uuid: fb38277f-1fd4-49d5-8d09-9d7037fdcce9
langcode: und
type: text
settings:

View File

@ -1,7 +1,6 @@
id: test_entity.test_bundle.field_test_import
uuid: 392b4e9d-6157-412e-9603-3d622512f498
langcode: und
field_uuid: fb38277f-1fd4-49d5-8d09-9d7037fdcce9
field_name: field_test_import
entity_type: test_entity
bundle: test_bundle
label: 'Test import field'

View File

@ -0,0 +1,22 @@
id: node.article.default
targetEntityType: node
bundle: article
viewMode: default
content:
body:
label: hidden
type: text_default
weight: '0'
settings: { }
field_tags:
type: taxonomy_term_reference_link
weight: '10'
label: above
settings: { }
field_image:
label: hidden
type: image
settings:
image_style: large
image_link: ''
weight: '-1'

View File

@ -0,0 +1,23 @@
id: node.article.teaser
targetEntityType: node
bundle: article
viewMode: teaser
content:
body:
label: hidden
type: text_summary_or_trimmed
weight: '0'
settings:
trim_length: '600'
field_tags:
type: taxonomy_term_reference_link
weight: '10'
label: above
settings: { }
field_image:
label: hidden
type: image
settings:
image_style: medium
image_link: content
weight: '-1'

View File

@ -0,0 +1,34 @@
id: field_image
type: image
module: image
active: '1'
settings:
uri_scheme: public
default_image: false
column_groups:
file:
label: File
columns:
- fid
- width
- height
alt:
label: Alt
translatable: true
title:
label: Title
translatable: true
storage:
type: field_sql_storage
module: field_sql_storage
active: '1'
settings: { }
locked: '0'
cardinality: '1'
translatable: '0'
entity_types: { }
indexes:
fid:
- fid
status: 1
langcode: und

View File

@ -0,0 +1,23 @@
id: field_tags
type: taxonomy_term_reference
module: taxonomy
active: '1'
settings:
allowed_values:
-
vocabulary: tags
parent: 0
storage:
type: field_sql_storage
module: field_sql_storage
active: '1'
settings: { }
locked: '0'
cardinality: '-1'
translatable: '0'
entity_types: { }
indexes:
tid:
- tid
status: 1
langcode: und

View File

@ -0,0 +1,30 @@
id: node.article.field_image
field_name: field_image
entity_type: node
bundle: article
label: Image
description: 'Upload an image to go with this article.'
required: false
default_value: { }
default_value_function: ''
settings:
file_directory: field/image
file_extensions: 'png gif jpg jpeg'
max_filesize: ''
max_resolution: ''
min_resolution: ''
alt_field: true
title_field: ''
alt_field_required: 0
title_field_required: 0
default_image: 0
user_register_form: false
widget:
type: image_image
settings:
progress_indicator: throbber
preview_image_style: thumbnail
weight: -1
module: image
status: 1
langcode: und

View File

@ -0,0 +1,21 @@
id: node.article.field_tags
field_name: field_tags
entity_type: node
bundle: article
label: Tags
description: 'Enter a comma-separated list of words to describe your content.'
required: false
default_value: { }
default_value_function: ''
settings:
user_register_form: false
widget:
type: taxonomy_autocomplete
weight: -4
settings:
size: '60'
autocomplete_path: taxonomy/autocomplete
placeholder: ''
module: taxonomy
status: 1
langcode: und

View File

@ -93,122 +93,6 @@ function standard_install() {
$user_settings = config('user.settings');
$user_settings->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save();
// Create a default field named "Tags" for the 'article' content type.
$field = array(
'field_name' => 'field_tags',
'type' => 'taxonomy_term_reference',
// Set cardinality to unlimited for tagging.
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
'settings' => array(
'allowed_values' => array(
array(
'vocabulary' => 'tags',
'parent' => 0,
),
),
),
);
field_create_field($field);
$help = st('Enter a comma-separated list of words to describe your content.');
$instance = array(
'field_name' => 'field_tags',
'entity_type' => 'node',
'label' => 'Tags',
'bundle' => 'article',
'description' => $help,
'widget' => array(
'type' => 'taxonomy_autocomplete',
'weight' => -4,
),
);
field_create_instance($instance);
// Assign display settings for the 'default' and 'teaser' view modes.
entity_get_display('node', 'article', 'default')
->setComponent($instance['field_name'], array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
))
->save();
entity_get_display('node', 'article', 'teaser')
->setComponent($instance['field_name'], array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
))
->save();
// Create an image field named "Image", enabled for the 'article' content type.
// Many of the following values will be defaulted, they're included here as an illustrative examples.
// See http://api.drupal.org/api/function/field_create_field/8
$field = array(
'field_name' => 'field_image',
'type' => 'image',
'cardinality' => 1,
'locked' => FALSE,
'indexes' => array('fid' => array('fid')),
'settings' => array(
'uri_scheme' => 'public',
'default_image' => FALSE,
),
'storage' => array(
'type' => 'field_sql_storage',
'settings' => array(),
),
);
field_create_field($field);
// Many of the following values will be defaulted, they're included here as an illustrative examples.
// See http://api.drupal.org/api/function/field_create_instance/8
$instance = array(
'field_name' => 'field_image',
'entity_type' => 'node',
'label' => 'Image',
'bundle' => 'article',
'description' => st('Upload an image to go with this article.'),
'required' => FALSE,
'settings' => array(
'file_directory' => 'field/image',
'file_extensions' => 'png gif jpg jpeg',
'max_filesize' => '',
'max_resolution' => '',
'min_resolution' => '',
'alt_field' => TRUE,
'title_field' => '',
),
'widget' => array(
'type' => 'image_image',
'settings' => array(
'progress_indicator' => 'throbber',
'preview_image_style' => 'thumbnail',
),
'weight' => -1,
),
);
field_create_instance($instance);
// Assign display settings for the 'default' and 'teaser' view modes.
entity_get_display('node', 'article', 'default')
->setComponent($instance['field_name'], array(
'label' => 'hidden',
'type' => 'image',
'settings' => array('image_style' => 'large', 'image_link' => ''),
'weight' => -1,
))
->save();
entity_get_display('node', 'article', 'teaser')
->setComponent($instance['field_name'], array(
'label' => 'hidden',
'type' => 'image',
'settings' => array('image_style' => 'medium', 'image_link' => 'content'),
'weight' => -1,
))
->save();
// Create user picture field.
module_load_install('user');
user_install_picture_field();