Skip to content

Commit 9adfba8

Browse files
authored
Merge pull request #1337 from 10up/docs/1336
Replace hookdoc with WP Hooks Documentor
2 parents 8587036 + 18977bd commit 9adfba8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2454
-22058
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ dist/*
44
docs-built/*
55
vendor/*
66
gulp-tasks/*
7+
wp-hooks-docs/*
78
tests/cypress/reports/*
89
tests/cypress/videos/*
910
tests/cypress/screenshots/*

.github/hookdoc-tmpl/layout.tmpl

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/hookdoc-tmpl/static/styles-10up.css

Lines changed: 0 additions & 99 deletions
This file was deleted.

.github/workflows/build-docs.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Hook Docs
1+
name: Build Developer Docs
22

33
on:
44
push:
@@ -11,13 +11,18 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1313

14+
- name: Setup proper PHP version
15+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
16+
with:
17+
php-version: 8.3
18+
1419
- name: Use desired version of NodeJS
1520
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
1621
with:
17-
node-version-file: '.nvmrc'
22+
node-version: 20
1823

1924
- name: Check versions
20-
run: npm -v; node -v
25+
run: npm -v; node -v; php -v
2126

2227
- name: npm install, and build docs
2328
run: |
@@ -31,4 +36,4 @@ jobs:
3136
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
3237
with:
3338
github_token: ${{ secrets.GITHUB_TOKEN }}
34-
publish_dir: './docs-built'
39+
publish_dir: './docs-built/build'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ tests/cypress/reports
1717
tests/cypress/downloads
1818

1919
distributor.zip
20+
/wp-hooks-docs/docs/hooks
21+
/wp-hooks-docs/docs/01.get-started/05.CHANGELOG.md

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,39 @@ By default, drafts are the preferred status and can't be changed at the source s
167167

168168
Oftentimes the communication Distributor attempts to make across sites using the REST API will be flagged by various security plugins and surreptitiously blocked. If you run into an issue like this, please reach out to the support for your security plugin and ask about getting Distributor unblocked ([here is an example for doing so with Wordfence](https://wordpress.org/support/topic/distributor-plugin-being-blocked/)).
169169

170+
## Building and Running Documentation Site
171+
172+
The Distributor documentation site is built using [WP Hooks Documentor](https://github.com/10up/wp-hooks-documentor). Follow these steps to build and run the documentation site locally:
173+
174+
### 1. Build Documentation
175+
Node.js >= 20.0 and PHP >= 8.3 will be needed in your development environment.
176+
177+
```bash
178+
# Install dependencies and build the plugin
179+
npm i && npm run build:docs
180+
```
181+
182+
This will:
183+
- Install all required dependencies
184+
- Process all hook documentation from the codebase
185+
- Generate the documentation site in the `./docs-built` directory
186+
187+
### 2. Run Documentation Site Locally
188+
189+
```bash
190+
# Navigate to docs-built directory and start the server
191+
cd ./docs-built && npm run serve
192+
```
193+
194+
The documentation site will be available at [http://localhost:3000](http://localhost:3000).
195+
196+
### 3. Deployment
197+
198+
The documentation site will automatically deploy to GitHub Pages when changes are merged into the `trunk` branch. You can view the live documentation at [https://10up.github.io/distributor/](https://10up.github.io/distributor/).
199+
170200
## Developers
171201

172-
See [Distributor Developer Documentation](https://10up.github.io/distributor/#developers).
202+
See [Distributor Developer Documentation](https://10up.github.io/distributor/get-started/developers).
173203

174204
## Frequently Asked Questions
175205

docs/tutorials.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

hookdoc-conf.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

includes/auto-distribute.php

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,10 @@ function enabled() {
5050
* to. These posts will be distributed as published posts, not drafts.
5151
*
5252
* @since 2.2.0
53-
* @hook dt_auto_distribution_enabled
5453
*
55-
* @param {bool} $enabled Whether the auto-distribution feature is enabled. Default false.
54+
* @param bool $enabled Whether the auto-distribution feature is enabled. Default false.
5655
*
57-
* @return {bool} Whether the auto-distribution feature is enabled.
56+
* @return bool Whether the auto-distribution feature is enabled.
5857
*/
5958
return apply_filters( 'dt_auto_distribution_enabled', false );
6059
}
@@ -77,12 +76,11 @@ function default_post_status( $post ) {
7776
* Filter the default status for auto-distributed posts.
7877
*
7978
* @since 2.2.0
80-
* @hook dt_auto_distribution_default_status
8179
*
82-
* @param {string} $status Default status for auto-distributed posts. Default 'publish'.
83-
* @param {WP_Post} $post Post object for the post being pushed.
80+
* @param string $status Default status for auto-distributed posts. Default 'publish'.
81+
* @param WP_Post $post Post object for the post being pushed.
8482
*
85-
* @return {string} Default status for auto-distributed posts.
83+
* @return string Default status for auto-distributed posts.
8684
*/
8785
return apply_filters( 'dt_auto_distribution_default_status', 'publish', $post );
8886
}
@@ -111,15 +109,14 @@ function auto_distribute_post( $post, $user_id, $connection_type, $connection_id
111109
* Filter to determine if a post should be auto-distributed.
112110
*
113111
* @since 2.2.0
114-
* @hook dt_auto_distribute_post
115112
*
116-
* @param {bool} $should_distribute Whether the post should be auto-distributed.
117-
* @param {WP_Post} $post WP_Post object for the post being pushed.
118-
* @param {int} $user_id User ID of the user pushing the post.
119-
* @param {string} $connection_type Type of connection ('external' or 'internal').
120-
* @param {int} $connection_id Connection ID.
113+
* @param bool $should_distribute Whether the post should be auto-distributed.
114+
* @param WP_Post $post WP_Post object for the post being pushed.
115+
* @param int $user_id User ID of the user pushing the post.
116+
* @param string $connection_type Type of connection ('external' or 'internal').
117+
* @param int $connection_id Connection ID.
121118
*
122-
* @return {bool} Whether the post should be auto-distributed.
119+
* @return bool Whether the post should be auto-distributed.
123120
*/
124121
return apply_filters( 'dt_auto_distribute_post', true, $post, $user_id, $connection_type, $connection_id );
125122
}
@@ -140,11 +137,10 @@ function auto_distribute_supported_post_types() {
140137
* Filter the post types that are auto-distributable.
141138
*
142139
* @since 2.2.0
143-
* @hook auto_distribute_supported_post_types
144140
*
145-
* @param {string[]} $post_types Array of post types that can be auto-distributed.
141+
* @param string[] $post_types Array of post types that can be auto-distributed.
146142
* Default is array( 'post', 'page' ).
147-
* @return {string[]} Array of post types that can be auto-distributed.
143+
* @return string[] Array of post types that can be auto-distributed.
148144
*/
149145
return apply_filters( 'auto_distribute_supported_post_types', $post_types );
150146
}
@@ -318,12 +314,10 @@ function get_external_connections( $post_id = 0, $user_id = 0 ) {
318314
* Modify the maximum number of external connection post types are
319315
* queried with requesting the post type.
320316
*
321-
* @hook dt_external_connections_per_page
322-
*
323317
* @since 2.2.0
324318
*
325-
* @param {int} $max_connections The maximum number of external connections to load.
326-
* @return {int} The maximum number of external connections to load.
319+
* @param int $max_connections The maximum number of external connections to load.
320+
* @return int The maximum number of external connections to load.
327321
*/
328322
'posts_per_page' => apply_filters( 'dt_external_connections_per_page', 200 ), // @codingStandardsIgnoreLine This high pagination limit is purposeful
329323
]

includes/bootstrap.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,10 @@ function() {
209209
* Filter whether the network connection type is enabled. Enabled by default, return false to disable.
210210
*
211211
* @since 1.0.0
212-
* @hook dt_network_site_connection_enabled
213212
*
214-
* @param {bool} true Whether the network connection should be enabled.
213+
* @param bool true Whether the network connection should be enabled.
215214
*
216-
* @return {bool} Whether the network connection should be enabled.
215+
* @return bool Whether the network connection should be enabled.
217216
*/
218217
apply_filters( 'dt_network_site_connection_enabled', true )
219218
) {

0 commit comments

Comments
 (0)