Skip to content

Commit 4d2ed41

Browse files
Added support for free-form documentation (#197)
* Added support for Freeform Documentation
1 parent 9dc0e61 commit 4d2ed41

18 files changed

+713
-2
lines changed

apigee_api_catalog.links.menu.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ apigee_api_catalog.apidoc.collection:
33
route_name: view.api_catalog_admin.page_1
44
description: 'List of all API documentation.'
55
parent: system.admin_content
6-
weight: 200
6+
weight: -1

apigee_api_catalog.links.task.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apidoc.admin:
22
title: API catalog
33
route_name: view.api_catalog_admin.page_1
44
base_route: system.admin_content
5-
weight: 10
5+
weight: -10
66

77
entity.node.apidoc.reimport_spec_form:
88
route_name: entity.node.reimport_spec_form
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Free-form documentation for Apigee
2+
type: module
3+
description: Free-form documentation for Apigee
4+
package: Apigee (Experimental)
5+
core_version_requirement: ^9
6+
dependencies:
7+
- apigee_api_catalog
8+
- file
9+
- text
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Copyright 2022 Google Inc.
6+
*
7+
* This program is free software; you can redistribute it and/or modify it under
8+
* the terms of the GNU General Public License version 2 as published by the
9+
* Free Software Foundation.
10+
*
11+
* This program is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13+
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14+
* License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License along
17+
* with this program; if not, write to the Free Software Foundation, Inc., 51
18+
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
20+
21+
/**
22+
* @file
23+
* Install, update, and uninstall functions for the Apigee Free-form module.
24+
*/
25+
26+
/**
27+
* Implements hook_install().
28+
*/
29+
function apigee_freeform_doc_install($is_syncing) {
30+
// Do not allow to delete the freeform_doc's node type machine name.
31+
$locked = \Drupal::state()->get('node.type.locked');
32+
$locked['freeform_doc'] = 'freeform_doc';
33+
\Drupal::state()->set('node.type.locked', $locked);
34+
}
35+
36+
/**
37+
* Implements hook_uninstall().
38+
*/
39+
function apigee_freeform_doc_uninstall() {
40+
// Allow to delete a freeform_doc's node type.
41+
$locked = \Drupal::state()->get('node.type.locked');
42+
unset($locked['freeform_doc']);
43+
\Drupal::state()->set('node.type.locked', $locked);
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node.freeform_doc.add_form:
2+
route_name: node.add
3+
title: 'Free-form Doc'
4+
route_parameters:
5+
node_type: 'freeform_doc'
6+
appears_on:
7+
- view.api_catalog_admin.page_1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apigee_freeform_doc.confirm_remove_views_references:
2+
path: '/admin/modules/uninstall/apigee-freeform-doc/confirm-remove-views-references'
3+
defaults:
4+
_title: 'Confirm remove views references'
5+
_form: 'Drupal\apigee_freeform_doc\Form\ConfirmRemoveViewsReferencesForm'
6+
requirements:
7+
_permission: 'administer modules'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
apigee_freeform_doc.event_subscriber:
3+
class: Drupal\apigee_freeform_doc\EventSubscriber\ApigeeFreeformDocSubscriber
4+
arguments: ['@messenger']
5+
tags:
6+
- { name: event_subscriber }
7+
8+
apigee_freeform_doc.uninstall_validator:
9+
class: Drupal\apigee_freeform_doc\ApigeeFreeformDocUninstallValidator
10+
tags:
11+
- { name: module_install.uninstall_validator }
12+
arguments: ['@entity_type.manager', '@string_translation']
13+
14+
apigee_freeform_doc.breadcrumb:
15+
class: Drupal\apigee_freeform_doc\ApigeeFreeformDocBreadcrumbBuilder
16+
tags:
17+
- { name: breadcrumb_builder, priority: 1000 }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
langcode: en
2+
status: true
3+
dependencies:
4+
config:
5+
- field.storage.node.body
6+
- node.type.freeform_doc
7+
module:
8+
- text
9+
id: node.freeform_doc.body
10+
field_name: body
11+
entity_type: node
12+
bundle: freeform_doc
13+
label: 'API Description'
14+
description: 'If the summary is not set, the trimmed API Description will end at the last full sentence before 200 character limit.'
15+
required: false
16+
translatable: true
17+
default_value: { }
18+
default_value_callback: ''
19+
settings:
20+
display_summary: true
21+
required_summary: false
22+
field_type: text_with_summary
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
langcode: en
2+
status: true
3+
dependencies:
4+
config:
5+
- field.storage.node.field_api_product
6+
- node.type.freeform_doc
7+
id: node.freeform_doc.field_api_product
8+
field_name: field_api_product
9+
entity_type: node
10+
bundle: freeform_doc
11+
label: 'API Product'
12+
description: 'Apigee API Product'
13+
required: false
14+
translatable: false
15+
default_value: { }
16+
default_value_callback: ''
17+
settings:
18+
handler: 'default:api_product'
19+
handler_settings:
20+
target_bundles: null
21+
auto_create: false
22+
field_type: entity_reference
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
langcode: en
2+
status: true
3+
dependencies:
4+
config:
5+
- field.storage.node.field_freeform_spec_doc
6+
- node.type.freeform_doc
7+
module:
8+
- file
9+
id: node.freeform_doc.field_freeform_spec_doc
10+
field_name: field_freeform_spec_doc
11+
entity_type: node
12+
bundle: freeform_doc
13+
label: 'Supporting docs'
14+
description: 'Upload the supporting doc/attachment here.'
15+
required: false
16+
translatable: false
17+
default_value: { }
18+
default_value_callback: ''
19+
settings:
20+
handler: 'default:file'
21+
handler_settings: { }
22+
file_directory: freeform_specs_doc
23+
file_extensions: 'zip jpg jpeg gif png txt html doc xls pdf ppt pps yaml'
24+
max_filesize: ''
25+
description_field: false
26+
field_type: file
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
langcode: en
2+
status: true
3+
dependencies:
4+
enforced:
5+
module:
6+
- apigee_freeform_doc
7+
module:
8+
- file
9+
- node
10+
id: node.field_freeform_spec_doc
11+
field_name: field_freeform_spec_doc
12+
entity_type: node
13+
type: file
14+
settings:
15+
target_type: file
16+
display_field: false
17+
display_default: false
18+
uri_scheme: public
19+
module: file
20+
locked: false
21+
cardinality: -1
22+
translatable: false
23+
indexes: { }
24+
persist_with_no_fields: false
25+
custom_storage: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
langcode: en
2+
status: true
3+
dependencies:
4+
module:
5+
- apigee_api_catalog
6+
- apigee_freeform_doc
7+
enforced:
8+
module:
9+
- apigee_freeform_doc
10+
type: freeform_doc
11+
name: 'Free-form Doc'
12+
description: 'Use <em>Free-form Doc</em> content to get Free-form Documentation.'
13+
help: ''
14+
new_revision: false
15+
display_submitted: false
16+
preview_mode: 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
langcode: en
2+
status: true
3+
dependencies:
4+
config:
5+
- field.field.node.freeform_doc.body
6+
- field.field.node.freeform_doc.field_api_product
7+
- field.field.node.freeform_doc.field_freeform_spec_doc
8+
- node.type.freeform_doc
9+
module:
10+
- file
11+
- path
12+
- text
13+
id: node.freeform_doc.default
14+
targetEntityType: node
15+
bundle: freeform_doc
16+
mode: default
17+
content:
18+
title:
19+
type: string_textfield
20+
weight: 0
21+
region: content
22+
settings:
23+
size: 60
24+
placeholder: ''
25+
third_party_settings: { }
26+
body:
27+
type: text_textarea_with_summary
28+
weight: 2
29+
settings:
30+
rows: 3
31+
summary_rows: 2
32+
placeholder: ''
33+
show_summary: false
34+
third_party_settings: { }
35+
region: content
36+
field_freeform_spec_doc:
37+
type: file_generic
38+
weight: 3
39+
region: content
40+
settings:
41+
progress_indicator: throbber
42+
third_party_settings: { }
43+
field_api_product:
44+
weight: 4
45+
settings:
46+
match_operator: CONTAINS
47+
match_limit: 10
48+
size: 60
49+
placeholder: ''
50+
third_party_settings: { }
51+
type: entity_reference_autocomplete
52+
region: content
53+
created:
54+
type: datetime_timestamp
55+
weight: 5
56+
region: content
57+
settings: { }
58+
third_party_settings: { }
59+
promote:
60+
type: boolean_checkbox
61+
settings:
62+
display_label: true
63+
weight: 6
64+
region: content
65+
third_party_settings: { }
66+
uid:
67+
type: entity_reference_autocomplete
68+
weight: 7
69+
settings:
70+
match_operator: CONTAINS
71+
size: 60
72+
placeholder: ''
73+
match_limit: 10
74+
region: content
75+
third_party_settings: { }
76+
sticky:
77+
type: boolean_checkbox
78+
settings:
79+
display_label: true
80+
weight: 8
81+
region: content
82+
third_party_settings: { }
83+
path:
84+
type: path
85+
weight: 9
86+
region: content
87+
settings: { }
88+
third_party_settings: { }
89+
status:
90+
type: boolean_checkbox
91+
settings:
92+
display_label: true
93+
weight: 10
94+
region: content
95+
third_party_settings: { }
96+
hidden: { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
langcode: en
2+
status: true
3+
dependencies:
4+
config:
5+
- field.field.node.freeform_doc.body
6+
- field.field.node.freeform_doc.field_api_product
7+
- field.field.node.freeform_doc.field_freeform_spec_doc
8+
- node.type.freeform_doc
9+
module:
10+
- file
11+
- text
12+
- user
13+
id: node.freeform_doc.default
14+
targetEntityType: node
15+
bundle: freeform_doc
16+
mode: default
17+
content:
18+
body:
19+
type: text_default
20+
label: hidden
21+
settings: { }
22+
third_party_settings: { }
23+
weight: 1
24+
region: content
25+
field_freeform_spec_doc:
26+
type: file_default
27+
label: hidden
28+
settings:
29+
use_description_as_link_text: true
30+
third_party_settings: { }
31+
weight: 2
32+
region: content
33+
links:
34+
settings: { }
35+
third_party_settings: { }
36+
weight: 0
37+
region: content
38+
hidden:
39+
field_api_product: true
40+
field_image: true

0 commit comments

Comments
 (0)