IntelliJ IDEA 13.1.0 Web Help

On this page:

Creating a IntelliJ IDEA project with a Drupal module

You can create a IntelliJ IDEA project that will be set up and configured in accordance with the Drupal requirements. This is done by creating a project by a Drupal Module template.

  1. On the main menu, choose File | New Project.
  2. In the Create New Project dialog box that opens, type the project name and specify the parent folder folder in the Location text box.
  3. From the Project type drop-down list, choose Drupal Module and click OK.
  4. In the Drupal Module dialog box that opens:
    1. Specify the the root folder of the Drupal installation in the Drupal installation path. Type the path manually or click the Browse button browseButton and select the relevant folder in the dialog box that opens.
    2. Select the Set up PHP | Include paths check box to have Drupal include paths automatically configured for the project. The following paths will be added to the Include Paths list on the PHP page of the Settings dialog box:
      1. <drupal installation root>/includes
      2. <drupal installation root>/modules
      3. <drupal installation root>/sites/all/modules

      Note

      The include paths are added to the list after you leave the dialog box.

    3. From the Version drop-down list, choose the version of Drupal to use, the supported versions are 6 and 7.

Importing a Drupal project

Besides creating a project anew according to the Drupal Module template, you can open an existing Drupal project in IntelliJ IDEA. IntelliJ IDEA recognizes the Drupal-specific structure and suggests activating the Drupal support in the project.

  1. Open the folder with the required Drupal project by choosing File | Open Directory.
  2. As soon as IntelliJ IDEA detects the Drupal-specific structure in the project, the following message is displayed in a pop-up window:

    drupalStructureDetected

    Click the Enable link.
  3. In the Drupal Module dialog box that opens, select the Enable Drupal integration check box and proceed as when creating a project with a Drupal module:
    1. Specify the the root folder of the Drupal installation in the Drupal installation path.
    2. Select the Set up PHP | Include paths check box to have Drupal include paths automatically configured for the project.
    3. From the Version drop-down list, choose the version of Drupal to use, the supported versions are 6 and 7.

You can update the Drupal integration settings at any time later in the Settings dialog box (File | Settings ).

Configuring the Drupal-Specific Development Environment

Whether you enable the Drupal support in an existing IntelliJ IDEA project or create a new project with a Drupal module, IntelliJ IDEA checks if the development environment is configured properly for Drupal development. Any detected inconsistency is reported in the Event Log tool window and in a pop-up window. For each discrepancy IntelliJ IDEA suggests a fix. To apply a suggestion, click the link next to the reported event.

drupalEventLog

Configuring file associations

To enable code highlighting, you need to set some additional file type associations to make IntelliJ IDEA recognize and treat them as php files. Do one of the following:

  • In the Event Log tool window, click the Fix link next to the Drupal support: <*.file extension> files are not associated with PHP file type message.
  • Use the File Types page of the Settings dialog box:
    1. Open the Settings dialog box by choosing File | Settings on the main menu, and click File Types.
    2. In the Registered Patterns area, add the patterns that defined Drupal files to be recognized as php files. To do that, click the Add button add and type the pattern in the Add Wildcard dialog box that opens.
Changing the Drupal settings

No matter whether you enable the Drupal support in an existing IntelliJ IDEA project or create a new Drupal module, you can update the Drupal settings at any time on the dedicated pages of the File | Settings dialog box.

  • Click Drupal and make the necessary changes on the Drupal page that opens:
    • To turn off the Drupal integration, clear the Enable Drupal integration check box. Note that this automatically excludes the folders specified as include paths.
    • Change the Drupal installation directory and the version of Drupal to use.
  • To change the include paths, click PHP and make the required changes in the Include Paths area of the PHP page that opens. Note that is the Drupal integration for is disabled, the paths are automatically excluded.
  • To change the code style settings, click Code Style, and then click PHP. On the Code Style: PHP page that opens, update the settings as necessary.

See Also

Procedures:

Reference:

External Links:

Web Resources: