Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating organization and updating drupal standards #21

Merged
merged 4 commits into from
Mar 13, 2020

Conversation

allgood2386
Copy link

breaking down standards to technology rather than drupal, moving drupal standards to its own section, and breaking out composer and good general application development + 12factor apps

…al standards to its own section, and breaking out composer and good general application development + 12factor apps
* [PHP Storm]
* [VSCode]

@todo this entire section below needs to be reviewed and updated
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a heavy review before it's merged in

* Variables should have the module prefix.
* Custom code, when possible, should be developed as a standalone library that a module can include and integrate with Drupal. This should mean using class namespaces and best OOP practices, and at that point we can use an alternative more flexible autoloading approach, like the one provided by composer.
* We always try to use Drupal functions where they exist. This helps with upgrades (among other things).
* Use `drupal_get_path();` to create a path to a file in your module directory.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't officially deprecated (yet), but it's no longer best practice. The new way to do this is:
$module_handler = \Drupal::service('module_handler'); $module_path = $module_handler->getModule('my_module')->getPath();

* Custom code, when possible, should be developed as a standalone library that a module can include and integrate with Drupal. This should mean using class namespaces and best OOP practices, and at that point we can use an alternative more flexible autoloading approach, like the one provided by composer.
* We always try to use Drupal functions where they exist. This helps with upgrades (among other things).
* Use `drupal_get_path();` to create a path to a file in your module directory.
* Use `path_to_theme();` to create a path to a file in the current theme directory.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now Drupal\Core\Theme\ActiveTheme::getPath();

@allgood2386
Copy link
Author

allgood2386 commented Jan 15, 2020

@jeffgreenberg just looked at your changes, those look good! sorry for the delay

@jeffgreenberg
Copy link

jeffgreenberg commented Jan 15, 2020 via email

@allgood2386 allgood2386 merged commit 45e109f into master Mar 13, 2020
@allgood2386
Copy link
Author

allgood2386 commented Mar 13, 2020

Hey folks, I know we still have work, but I'm going to merge in what we have so far so this doesn't get stale. The branch is still in this repo so feel free to add on to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants