You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/integrations.md
+28-10Lines changed: 28 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,24 @@ play nicely with Phpactor, for the others there is this page.
10
10
Drupal 8
11
11
--------
12
12
13
+
### Bootstrapping
14
+
13
15
Drupal automatically adds its modules to the autoloader during the kernel
14
16
boot process. It is therefore necessary to either 1) boot the kernel to have a fully
15
17
useful autoloader *or* 2) to use a different mechanism to add the modules to the Composer autoloader.
16
18
17
19
Depending on your setup option 1 or 2 will be preferable.
18
20
19
-
### Option 1: Bootstrap Drupal on the fly to generate the autoloader
21
+
In both cases deregister the autoloader in `.phpactor.yml`:
22
+
23
+
```yaml
24
+
# Bootstrapping Drupal creates lots of implicit global
25
+
# dependencies, so we will just keep the Drupal autoloader
26
+
# registered and hope for the best.
27
+
autoload.deregister: false
28
+
```
29
+
30
+
#### Option 1: Bootstrap Drupal on the fly to generate the autoloader
20
31
21
32
Create the following bootstrap file `autoload_phpactor.php`, in (for example)
22
33
`web/`:
@@ -58,19 +69,11 @@ Then edit `.phpactor.yml` to use that:
58
69
```yaml
59
70
# Use the special autoloader above
60
71
autoload: web/phpactor_autoload.php
61
-
62
-
# Drupal CS is 2 spaces
63
-
code_transform.indentation: 2
64
-
65
-
# Bootstrapping Drupal creates lots of implicit global
66
-
# dependencies, so we will just keep the Drupal autoloader
67
-
# registered and hope for the best.
68
-
autoload.deregister: false
69
72
```
70
73
71
74
The downside to this option is that it requires access to the DB from your current environment which may be tricky if you are running Drupal inside a VM.
72
75
73
-
### Option 2: Add the modules into the Composer autoloader
76
+
#### Option 2: Add the modules into the Composer autoloader
74
77
75
78
This option requires merging in any modules (Drupal, contrib, custom) into the Composer autoloader via a discovery mechanism offered by the [Drupal Autoloader](https://github.com/fenetikm/autoload-drupal) composer plugin.
76
79
@@ -100,3 +103,18 @@ composer autoload-dump
100
103
```
101
104
102
105
The upside to this option is that it won't require the relatively slow Drupal bootstrap (which will hit the DB) but the downside is that you will have to regenerate the autoloader every time you add / remove a module.
106
+
107
+
#### Coding Standards
108
+
109
+
Change your local `.phpactor.yml` to use 2 spaces for indentation:
110
+
111
+
```
112
+
# Drupal CS is 2 spaces
113
+
code_transform.indentation: " "
114
+
```
115
+
116
+
<div class="alert alert-info">
117
+
Code will still be generated using the PSR-2 standard. It would be necessary
118
+
to override twig templates in `.phpactor/templates` to rectify this (or just
0 commit comments