Drupal: Difference between revisions
Jump to navigation
Jump to search
(→DDEV) |
|||
(19 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
* [https://vitux.com/how-to-install-drupal-on-ubuntu-20-04/ How to Install Drupal on Ubuntu 20.04] | * [https://vitux.com/how-to-install-drupal-on-ubuntu-20-04/ How to Install Drupal on Ubuntu 20.04] | ||
* [https://www.howtoforge.com/how-to-install-drupal-on-debian-12/ How to Install Drupal CMS with Apache on Debian 12] | * [https://www.howtoforge.com/how-to-install-drupal-on-debian-12/ How to Install Drupal CMS with Apache on Debian 12] | ||
* [https://www.howtoforge.com/how-to-install-drupal-on-alma-linux-9 How to Install Drupal on Alma Linux 9] | |||
* Youtube | * Youtube | ||
Line 12: | Line 13: | ||
** Training 2: Content and Fields | ** Training 2: Content and Fields | ||
** Training 3: Taxonomy, Media and Modules | ** Training 3: Taxonomy, Media and Modules | ||
*** '''Formatter''' should be changed from "Label" to '''Rendered entity''' for Videos, PDFs, ... in "Manage display" tab. | |||
*** View mode. '''Full content'''. | |||
** Training 4: Users and Themes | ** Training 4: Users and Themes | ||
** Training 5: Layout | ** Training 5: Layout and Views | ||
** Training 6: Finish the Design | ** Training 6: Finish the Design | ||
== Views == | |||
* [https://youtu.be/_ebJ1xf-xeQ Getting Started with Views in Drupal] 2021, [https://www.youtube.com/playlist?list=PLL73GOh1BF-muXlOTHyFMoIWp77J7mp19 A playlist] 2023 by WebWash | |||
= Websites by drupal = | = Websites by drupal = | ||
Line 21: | Line 27: | ||
** Search "sites" in the source code. The most reliable ways to show if a site is using Drupal is to check the source code. In the source code, check to see if important files are being loaded from the '''/sites/''' folder. | ** Search "sites" in the source code. The most reliable ways to show if a site is using Drupal is to check the source code. In the source code, check to see if important files are being loaded from the '''/sites/''' folder. | ||
** Search "drupal" in the source code | ** Search "drupal" in the source code | ||
= Composer = | |||
<ul> | |||
<li>[https://getcomposer.org/ Composer] is a '''dependency manager''' for '''PHP'''. Drupal core uses Composer to manage core dependencies like Symfony components and Guzzle. | |||
* PHP has to be installed. Use ''php -v'' to check your PHP version. | |||
<li>[https://www.drupal.org/docs/develop/using-composer/using-composer-with-drupal Using Composer with Drupal] | |||
<li>'''You can use Composer to download and install Drupal core''', as well as contributed modules, themes, and their third-party dependencies. | |||
<li>Composer can also be used to update Drupal and its dependencies. | |||
<li>[https://getcomposer.org/doc/03-cli.md List of composer commands] | |||
* composer install: This command reads the composer.json file from the current directory, resolves the dependencies, and installs them into the vendor directory. | |||
* composer require: This command adds new packages to the composer.json file and installs them. For example, '''composer require drush/drush''' will install '''drush'''. We can use a similar command to install drupal. | |||
* composer update: This command updates the dependencies to their latest versions according to the composer.json file. | |||
* composer remove: This command removes packages from the composer.json file and reupdates the dependencies. | |||
* composer list: list all commands | |||
* composer self-update. | |||
</li> | |||
</ul> | |||
== Install Drupal == | |||
* Installing Drupal, Drush and Console - from the course of [https://www.linkedin.com/learning/linux-for-php-developers/installing-drupal-drush-and-console Linux for PHP developers] (linkedin), although this is not a recommended installation way of WordPress and Drupal. | |||
= DDEV and PHP = | = DDEV and PHP = | ||
Line 29: | Line 58: | ||
<li>The software support Mac, Windows, Linux and Cloud. | <li>The software support Mac, Windows, Linux and Cloud. | ||
* [https://www.gitpod.io/ Gitpod] for cloud deployment. The free plan has some limitations per month. | |||
* [https://www.gitpod.io/ Gitpod] for cloud deployment | |||
<li>https://github.com/ddev/ddev | <li>https://github.com/ddev/ddev | ||
Line 46: | Line 74: | ||
</ul> | </ul> | ||
== | == Different CMS project types == | ||
Other than Drupal, it also supports other CMS and PHP frameworks such as WordPress, BackDrop, TYPO3, Magento, et al. See [https://ddev.readthedocs.io/en/latest/users/quickstart/ CMS Quickstarts] for a list. | |||
For Drupal 10, | |||
<syntaxhighlight lang='sh'> | |||
mkdir my-drupal10-site | |||
cd my-drupal10-site | |||
ddev config --project-type=drupal10 --docroot=web --create-docroot | |||
ddev start | |||
ddev composer create drupal/recommended-project | |||
ddev composer require drush/drush | |||
ddev drush site:install --account-name=admin --account-pass=admin -y | |||
ddev drush uli | |||
ddev launch | |||
</syntaxhighlight> | |||
== Drupal Local Development Guide == | |||
https://www.drupal.org/docs/official_docs/local-development-guide. | |||
== Drush == | == Drush == | ||
<ul> | |||
<li>[https://www.drupal.org/docs/develop/development-tools/drush Drush], also known as the '''Drupal Shell''', is a command-line utility and scripting interface for Drupal. It’s widely used in Drupal development and system administration. It’s recommended to use composer to install Drush inside your project. | |||
* '''Speeds up tasks''': Drush can speed up installing, developing, debugging, and maintaining Drupal sites. | |||
* '''Generates boilerplate code''': It’s capable of generating boilerplate code for custom developments. | |||
* '''Command-line interface''': Rather than clicking through the admin interface to achieve something, you simply type in one command. | |||
<li>It’s recommended to use '''composer''' to install Drush inside your project. Local dev tools such as '''DDEV''' or '''Lando''' provide aliases to run Drush without path and from any directory. | |||
<li>Some drush commands | |||
<pre> | <pre> | ||
# Commands list | # Commands list | ||
Line 84: | Line 118: | ||
# The same with an alias | # The same with an alias | ||
drush cr | drush cr | ||
</pre> | |||
</li> | |||
</ul> | |||
== Upgrading DDEV == | |||
[https://ddev.readthedocs.io/en/latest/users/install/ddev-upgrade/ Upgrading DDEV]. For Linux, we do | |||
<pre> | |||
sudo apt update && sudo apt upgrade | |||
</pre> | </pre> | ||
= Install | = Install = | ||
<ul> | <ul> | ||
<li>[https://www.linode.com/docs/guides/how-to-install-drupal-with-docker-compose-debian-10/ Installing Drupal with Docker Compose on Debian 10] | <li>[https://www.linode.com/docs/guides/how-to-install-drupal-with-docker-compose-debian-10/ Installing Drupal with Docker Compose on Debian 10] | ||
<li>[https://www.howtoforge.com/how-to-install-drupal-with-docker-on-ubuntu-22-04/ How to Install Drupal with Docker on Ubuntu 22.04] | <li>[https://www.howtoforge.com/how-to-install-drupal-with-docker-on-ubuntu-22-04/ How to Install Drupal with Docker on Ubuntu 22.04] | ||
<li>[https://www.howtoforge.com/how-to-install-drupal-on-ubuntu-24-04/ How to Install Drupal CMS with Apache and Free Let's Encrypt SSL on Ubuntu 24.04] | |||
<li>[https://www.digitalocean.com/community/tutorials/how-to-develop-a-drupal-9-website-on-your-local-machine-using-docker-and-ddev How To Develop a Drupal 9 Website on Your Local Machine Using Docker and DDEV] 2020/8. Installation looks fine but I got a message '400 Bad Request The plain HTTP request was sent to HTTPS port' after I try to sign in. In fact, the operations still work. If I manually changed the URL from "http" to "https", it'll show the new results. | <li>[https://www.digitalocean.com/community/tutorials/how-to-develop-a-drupal-9-website-on-your-local-machine-using-docker-and-ddev How To Develop a Drupal 9 Website on Your Local Machine Using Docker and DDEV] 2020/8. Installation looks fine but I got a message '400 Bad Request The plain HTTP request was sent to HTTPS port' after I try to sign in. In fact, the operations still work. If I manually changed the URL from "http" to "https", it'll show the new results. | ||
<pre> | <pre> | ||
Line 102: | Line 145: | ||
</pre> | </pre> | ||
<li>[https://hub.docker.com/r/bitnami/drupal Bitnami package for Drupal]. The username/password is user/bitnami. It worked. | <li>[https://hub.docker.com/r/bitnami/drupal Bitnami package for Drupal]. The username/password is user/bitnami. It worked. | ||
<li>[https://jigarius.com/blog/drupal-with-ddev Dockerize Drupal with Ddev] | |||
</ul> | </ul> | ||
Line 110: | Line 154: | ||
<li>[https://dev.to/shriaas2898/setting-up-drupal9-multi-site-with-ddev-2f22 Setting up drupal9 multi-site with DDEV] 2021/9 and a [https://www.youtube.com/watch?v=MvXJJllmW8I video] | <li>[https://dev.to/shriaas2898/setting-up-drupal9-multi-site-with-ddev-2f22 Setting up drupal9 multi-site with DDEV] 2021/9 and a [https://www.youtube.com/watch?v=MvXJJllmW8I video] | ||
</ul> | </ul> | ||
== Upgrade == | |||
<ul> | |||
<li>[https://www.drupal.org/project/drupal/releases/10.2.2 drupal 10.2.2]. Currently I am running Drupal 10.2.0. It works.</br> | |||
To update your site and all dependencies to the latest version of Drupal: | |||
{{Pre}} | |||
composer update "drupal/core-*" --with-all-dependencies | |||
drush updatedb | |||
drush cache:rebuild | |||
# Check Status report under Reports. Fix all errors and warnings. | |||
</pre> | |||
To update your site to this specific release: | |||
{{Pre}} | |||
composer require drupal/core-recommended:10.2.2 drupal/core-composer-scaffold:10.2.2 drupal/core-project-message:10.2.2 --update-with-all-dependencies | |||
</pre> | |||
<li>[https://www.drupal.org/docs/updating-drupal/updating-drupal-core-via-composer Updating Drupal core via Composer] | |||
<li>[https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-6-or-drupal-7/upgrade-using-drush Upgrade using Drush] | |||
<li>[https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/how-to-upgrade-from-drupal-9-to-drupal-10 How to upgrade from Drupal 9 to Drupal 10] | |||
<li>[https://drupalize.me/tutorial/upgrade-drupal-10 Upgrade to Drupal 10 for Drupal 9, 10] | |||
</ul> | |||
= User Guide = | |||
[https://www.drupal.org/docs/user_guide/en/index.html User Guide] | |||
* [https://www.drupal.org/docs/user_guide/en/config-chapter.html Chapter 4. Basic Site Configuration] | |||
** Administrative Overview -> Contextual links (module). It is a '''pencil icon'''. | |||
** Edit basic site info | |||
** Install/uninstall modules | |||
** Configure user account settings | |||
** Configure the theme | |||
* [https://www.drupal.org/docs/user_guide/en/content-chapter.html Chapter 5. Basic Page Management] | |||
** URL, Path, '''Alias'''. If you have an "About Us" page with the path ''node/7'', you can set up an alias so that your visitors will see it as ''<nowiki>http://www.example.com/AboutUs</nowiki>''. | |||
** Create a content item | |||
** Designate a front page | |||
** In-place editor | |||
** '''Menu'''. Menus are a collection of links used to '''navigate''' a website. A menu link will only be shown to a visitor if they have the rights to view the page it links to. For example, the admin menu link is not shown to visitors who are not logged in. | |||
** Add a page to the '''navigation''' (top-right corner, default is 'Home', My Account, Log out) | |||
** Change the order of '''navigation''' | |||
* [https://www.drupal.org/docs/user_guide/en/content-structure-chapter.html Chapter 6. Setting Up Content Structure] | |||
** Add/delete a '''content type''' (Vendor, Recipe). Structure -> Content types. | |||
** Add basic '''fields''' to a content type (Label = 'Vendor URL', 'Main image') | |||
** Concept: '''Reference fields''' | |||
** Concept: '''Taxonomy''' (tags) | |||
** Setting up a Taxonomy (Structure -> Taxonomy). Add 'Ingredients' as the '''vocabulary''' name. Then add a '''Term''' with the name 'Butter'. After that, add more terms: Eggs, Milk. | |||
*** Structure > Content Types -> Recipe. Add a new field "Ingredients" (existing ones are "Main image" & "Vendor URL"). | |||
** Add a reference field. Structure > Content types -> Recipe -> Add field "Submitted by". | |||
** Concept: '''Forms''' and '''widgets''' | |||
** Content entry forms. Structure > Content types -> Recipe -> '''Manage form display'''. | |||
** Concept: '''View modes''' and '''formatters''' | |||
** Change content display. Structure > Content types -> Vendor -> '''Manage display'''. | |||
** Concept: '''Image styles''' | |||
** Set up an image styles. Configuration > Media > Image styles. | |||
*** Structure > Content types -> Vendor -> Manage display page. Main image -> Gear wheel 0> Image style. Open a Vendor content item (e.g. Sweet Honey or Happy Farm) and verify that it now shows up with the scaled-down image (it works). | |||
** Responsive image styles | |||
** Concept: '''Text formats''' and '''Editors''' | |||
** Configuring Text Formats and Editors. Configuration > Content authoring > Text formats and editors. |
Latest revision as of 18:32, 27 June 2024
Resource
- https://www.drupal.org/home
- Advertising sustains the DA. Set up a local development Drupal site on the latest Ubuntu LTS version and more
- How to Install Drupal on Ubuntu 20.04
- How to Install Drupal CMS with Apache on Debian 12
- How to Install Drupal on Alma Linux 9
- Youtube
- Drupal 8 Beginner Tutorials - the BEST Drupal videos 63 short videos
- A Complete Guide on Drupal 9 Site Building | Drupal Basics | Step By Step Guide one long video from SJ Innovation
- LinkedIn. Build Your Drupal Skills. Drupal 9. Updated Oct 2021. OSTraining. Acquia has stopped support for Dev Desktop on June 30, 2021.
- Training 1: Introduction & Admin
- Training 2: Content and Fields
- Training 3: Taxonomy, Media and Modules
- Formatter should be changed from "Label" to Rendered entity for Videos, PDFs, ... in "Manage display" tab.
- View mode. Full content.
- Training 4: Users and Themes
- Training 5: Layout and Views
- Training 6: Finish the Design
Views
- Getting Started with Views in Drupal 2021, A playlist 2023 by WebWash
Websites by drupal
- How Do I Know If My Website is Drupal?
- 5 Ways to Tell if a Site is Built in Drupal
- Search "sites" in the source code. The most reliable ways to show if a site is using Drupal is to check the source code. In the source code, check to see if important files are being loaded from the /sites/ folder.
- Search "drupal" in the source code
Composer
- Composer is a dependency manager for PHP. Drupal core uses Composer to manage core dependencies like Symfony components and Guzzle.
- PHP has to be installed. Use php -v to check your PHP version.
- Using Composer with Drupal
- You can use Composer to download and install Drupal core, as well as contributed modules, themes, and their third-party dependencies.
- Composer can also be used to update Drupal and its dependencies.
- List of composer commands
- composer install: This command reads the composer.json file from the current directory, resolves the dependencies, and installs them into the vendor directory.
- composer require: This command adds new packages to the composer.json file and installs them. For example, composer require drush/drush will install drush. We can use a similar command to install drupal.
- composer update: This command updates the dependencies to their latest versions according to the composer.json file.
- composer remove: This command removes packages from the composer.json file and reupdates the dependencies.
- composer list: list all commands
- composer self-update.
Install Drupal
- Installing Drupal, Drush and Console - from the course of Linux for PHP developers (linkedin), although this is not a recommended installation way of WordPress and Drupal.
DDEV and PHP
- DDEV is an open-source tool that makes it simple to set up local PHP development environments within minutes. It’s often used for Drupal development, and it has built-in support for Drush, the command-line utility and scripting interface for Drupal.
- https://www.drupal.org/ddev. DDEV builds the DDEV-Local tool, which helps PHP developers remove the complexity of local containerized development across operating systems and hosting providers.
- The software support Mac, Windows, Linux and Cloud.
- Gitpod for cloud deployment. The free plan has some limitations per month.
- https://github.com/ddev/ddev
- DDEV and Drush
- Drush commands in DDEV: ddev exec drush --version
- Drush Use with DDEV: drush site:set
- Environment Variables in DDEV: you can set an environment variable in your .ddev/config.yaml
- Performance Improvements
- DDEV and Composer
- DDEV has built-in Composer commands
- Commands: DDEV provides the ddev composer and ddev composer create commands. These run Composer inside the container.
Different CMS project types
Other than Drupal, it also supports other CMS and PHP frameworks such as WordPress, BackDrop, TYPO3, Magento, et al. See CMS Quickstarts for a list.
For Drupal 10,
mkdir my-drupal10-site cd my-drupal10-site ddev config --project-type=drupal10 --docroot=web --create-docroot ddev start ddev composer create drupal/recommended-project ddev composer require drush/drush ddev drush site:install --account-name=admin --account-pass=admin -y ddev drush uli ddev launch
Drupal Local Development Guide
https://www.drupal.org/docs/official_docs/local-development-guide.
Drush
- Drush, also known as the Drupal Shell, is a command-line utility and scripting interface for Drupal. It’s widely used in Drupal development and system administration. It’s recommended to use composer to install Drush inside your project.
- Speeds up tasks: Drush can speed up installing, developing, debugging, and maintaining Drupal sites.
- Generates boilerplate code: It’s capable of generating boilerplate code for custom developments.
- Command-line interface: Rather than clicking through the admin interface to achieve something, you simply type in one command.
- It’s recommended to use composer to install Drush inside your project. Local dev tools such as DDEV or Lando provide aliases to run Drush without path and from any directory.
- Some drush commands
# Commands list drush # Help about a command drush help cache:clear # Help about a more detailed topic drush topic [topic] # Empty cache (The most used command) drush cache:rebuild # The same with an alias drush cr
Upgrading DDEV
Upgrading DDEV. For Linux, we do
sudo apt update && sudo apt upgrade
Install
- Installing Drupal with Docker Compose on Debian 10
- How to Install Drupal with Docker on Ubuntu 22.04
- How to Install Drupal CMS with Apache and Free Let's Encrypt SSL on Ubuntu 24.04
- How To Develop a Drupal 9 Website on Your Local Machine Using Docker and DDEV 2020/8. Installation looks fine but I got a message '400 Bad Request The plain HTTP request was sent to HTTPS port' after I try to sign in. In fact, the operations still work. If I manually changed the URL from "http" to "https", it'll show the new results.
ddev list ┌────────┬─────────┬──────────┬──────────────────────────┬─────────┐ │ NAME │ STATUS │ LOCATION │ URL │ TYPE │ ├────────┼─────────┼──────────┼──────────────────────────┼─────────┤ │ d9test │ OK │ ~/d9test │ https://d9test.ddev.site │ drupal9 │ ├────────┼─────────┼──────────┼──────────────────────────┼─────────┤ │ Router │ healthy │ ~/.ddev │ http://127.0.0.1:10999 │ traefik │ └────────┴─────────┴──────────┴──────────────────────────┴─────────┘
- Bitnami package for Drupal. The username/password is user/bitnami. It worked.
- Dockerize Drupal with Ddev
Videos (youtube: ddev drupal)
- Drupal 10 Quick and Easy Installation with DDEV | Drupal Tutorial 2023/4
- Setup Drupal 9 with DDEV-Local in 5 minutes
- Setting up drupal9 multi-site with DDEV 2021/9 and a video
Upgrade
- drupal 10.2.2. Currently I am running Drupal 10.2.0. It works.
To update your site and all dependencies to the latest version of Drupal:composer update "drupal/core-*" --with-all-dependencies drush updatedb drush cache:rebuild # Check Status report under Reports. Fix all errors and warnings.
To update your site to this specific release:
composer require drupal/core-recommended:10.2.2 drupal/core-composer-scaffold:10.2.2 drupal/core-project-message:10.2.2 --update-with-all-dependencies
- Updating Drupal core via Composer
- Upgrade using Drush
- How to upgrade from Drupal 9 to Drupal 10
- Upgrade to Drupal 10 for Drupal 9, 10
User Guide
- Chapter 4. Basic Site Configuration
- Administrative Overview -> Contextual links (module). It is a pencil icon.
- Edit basic site info
- Install/uninstall modules
- Configure user account settings
- Configure the theme
- Chapter 5. Basic Page Management
- URL, Path, Alias. If you have an "About Us" page with the path node/7, you can set up an alias so that your visitors will see it as http://www.example.com/AboutUs.
- Create a content item
- Designate a front page
- In-place editor
- Menu. Menus are a collection of links used to navigate a website. A menu link will only be shown to a visitor if they have the rights to view the page it links to. For example, the admin menu link is not shown to visitors who are not logged in.
- Add a page to the navigation (top-right corner, default is 'Home', My Account, Log out)
- Change the order of navigation
- Chapter 6. Setting Up Content Structure
- Add/delete a content type (Vendor, Recipe). Structure -> Content types.
- Add basic fields to a content type (Label = 'Vendor URL', 'Main image')
- Concept: Reference fields
- Concept: Taxonomy (tags)
- Setting up a Taxonomy (Structure -> Taxonomy). Add 'Ingredients' as the vocabulary name. Then add a Term with the name 'Butter'. After that, add more terms: Eggs, Milk.
- Structure > Content Types -> Recipe. Add a new field "Ingredients" (existing ones are "Main image" & "Vendor URL").
- Add a reference field. Structure > Content types -> Recipe -> Add field "Submitted by".
- Concept: Forms and widgets
- Content entry forms. Structure > Content types -> Recipe -> Manage form display.
- Concept: View modes and formatters
- Change content display. Structure > Content types -> Vendor -> Manage display.
- Concept: Image styles
- Set up an image styles. Configuration > Media > Image styles.
- Structure > Content types -> Vendor -> Manage display page. Main image -> Gear wheel 0> Image style. Open a Vendor content item (e.g. Sweet Honey or Happy Farm) and verify that it now shows up with the scaled-down image (it works).
- Responsive image styles
- Concept: Text formats and Editors
- Configuring Text Formats and Editors. Configuration > Content authoring > Text formats and editors.