1

When we say 'core' we mean the whole of Drupal core that you get from the Drupal project page.

On D7, core code that wasn't in modules tended to be called 'the includes' IIRC.

But on D8 they're not include files any more. They in core/lib/Drupal and we have:

  • core/lib/Drupal
  • core/lib/Drupal/Core
  • core/lib/Drupal/Components
  • core/lib/Drupal/Core/Foo
  • core/lib/Drupal/Components/Foo

What's the correct way to refer to these?

6
  • 1
    Oh gee, I wonder what that lib stands for.
    – No Sssweat
    Commented Feb 27, 2020 at 14:11
  • they're not include files any more Yeah they are, they're just included via a PSR autoloader rather than directly now. I doubt this question will have an answer that isn't just an individual's personal preference
    – Clive
    Commented Feb 27, 2020 at 14:17
  • 1
    @Clive You could also say that the majority of Drupal 7 files weren't includes, either, in the PHP sense of manually using require() and friends. Most files were managed by the Module API, and that exposed a way to handle things that couldn't be wired up magially.
    – mpdonadio
    Commented Feb 27, 2020 at 17:42
  • What I meant was that on D7 they were files called includes/foo.inc and now they're not.
    – joachim
    Commented Feb 28, 2020 at 15:49
  • "I doubt this question will have an answer that isn't just an individual's personal preference" -- right, but then why don't we have a standard way of referring to these so we're not confused?
    – joachim
    Commented Feb 28, 2020 at 15:50

1 Answer 1

4

What you describe is correct, when you install Drupal, everything in the 'core' directory is considered the core set of Drupal files, or the bare minimum installation package.

The files in 'core/lib' is essentially all of the source code for the running system. Personally, this is what "core" means to me. The files (for the most part1) outside of that are the scaffold (or support files).

The files in 'core/lib/Drupal/Core' are called "Core", pronounced with a big C. The files in 'core/lib/Drupal/Component' are called "Component", pronounced with a big C. Confusing, yes?

"Component" are the set of files that Drupal uses, but don't actually rely on anything else in "Core". For example, DateTimePlus and Time are two Components, that don't need anything in 'core/lib/Drupal/Core'.

"Core" are the set of files that Drupal uses, but are interdependent on each other, and also require "Component". For example, DrupalDateTime relies on DateTimePlus (in Component) and the Language subsystem (in Core).

1Ignoring tests for this discussion.

1
  • "pronounced with a big C. The files in 'core/lib/Drupal/Component' are called "Component", pronounced with a big C. Confusing, yes" -- Yes. Where's the plan to fix this?
    – joachim
    Commented Mar 11, 2020 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.