

Use the pre-configured Drupal code style in a project However, you can at any time change or customize this setting on the Code Style: PHP page of the Settings dialog. PhpStorm automatically offers to apply the pre-configured Drupal Coding Standards (code style) if a project is recognized as a Drupal Module, or if the Drupal integration is enabled in an existing project, or when you create a new project with a Drupal Module. Setting up Drupal code style in a PhpStorm project api.php files provided by core and many other modules for reference purposes.

Position the caret at the name of the hook and choose View | Quick Documentation Lookup or press Ctrl+Q.ĭocumentation is taken from. You will be navigated to the line where the relevant hook is invoked with module_invoke_all(), module_invoke(), or drupal_alter(). In case of multiple invocations, PhpStorm displays a list of available hook invocations, and you can choose the one to jump to.

To navigate to a hook invocation from the editor, click the icon in the gutter. To complete a declaration, start typing the hook name and press Ctrl+Space. PhpStorm indexes any hook invocation whereupon hook names become available in code completion for creating hook implementations. Use code completion for hook declarations
#Drupal tutorial for developers full#
PhpStorm provides full native support of Drupal hooks in. If the Drupal integration is disabled, the paths are automatically excluded. On the PHP page that opens, make the required changes in the Include Path area.

In the Settings dialog ( Ctrl+Alt+S), navigate to PHP. To use another Drupal installation, type the path to the relevant installation folder. On the Frameworks page that opens, toggle the Enable Drupal integration checkbox to activate or deactivate Drupal in the current PhpStorm project. In the Settings dialog ( Ctrl+Alt+S), navigate to PHP | Frameworks. See File type associations for details.Ĭhanging the Drupal settings Option 1: Enable or disable Drupal integration On the File Types page that opens, define file masks in the File Name Patterns area. In the Settings dialog ( Ctrl+Alt+S), navigate to Editor | File Types. In the Event Log tool window, click Fix next to the Drupal support: files are not associated with PHP file type message. PhpStorm recognizes and treats files as php files and provides code highlighting based on file type associations. Associating Drupal-specific files with the PHP file type To apply a suggestion, click the link next to the reported event. For each discrepancy PhpStorm suggests a fix. Whether you enable the Drupal support in an existing PhpStorm project or create a new project with a Drupal module, PhpStorm checks if the development environment is configured properly for Drupal development.Īny detected inconsistency is reported in the Event Log tool window and as a popup. In the Drupal Module dialog that opens, select the Enable Drupal integration checkbox and proceed as when creating a project with a Drupal module: specify the root folder of the Drupal installation, choose the version to use, and configure include paths. PhpStorm detects a Drupal-specific structure and shows a notification:Ĭlick Enable in the notification. When you open an existing Drupal module, PhpStorm recognizes the Drupal-specific structure and suggests activating the Drupal support.Ĭlick Open on the Welcome screen or choose File | Open from the main menu, then choose the folder where your Drupal module is stored. After you leave the dialog, the following paths will be added to the Include Paths list on the PHP page: /includes, /modules, and /sites/all/modules Select the Set up PHP | Include paths checkbox to have Drupal include paths automatically configured for the project. Later you can change the Drupal installation and re-configure the include paths on the Frameworks page as described in Changing the Drupal settings Specify the root folder of the Drupal installation and choose the version of Drupal to use, the supported versions are 6, 7, 8, and 9.ĭrupal 10 is currently not supported, use version 9 in the IDE settings instead. In the Location field on the right-hand pane, specify the folder where the project will be created. In the left-hand pane, select Drupal Module. For Drupal 8, a module_ file is generated.Ĭhoose File | New Project or click Create New Project on the PhpStorm Welcome screen. PhpStorm generates and configured a project stub in accordance with the selected Drupal version. You can create a PhpStorm project by a Drupal Module template, this project will be set up and configured in accordance with the Drupal requirements.
