19
votes
Accepted
Problem installing in local "The translation server is offline"
I think you didn't select English in the first step, and probably your Internet connection is behind a proxy and I guess Drupal doesn't support it.
You can select English and continue or:
Go to ...
- 3,541
19
votes
Accepted
How do I create a role programmatically?
The problem is in the data array change name by label:
$role = \Drupal\user\Entity\Role::create(array('id' => 'client', 'label' => 'Client'));
$role->save();
Or you can use:
//your data ...
17
votes
Accepted
Cannot install any theme
This is an nginx configuration issue and discussed intensely on this page Yet curiously no solid solution could be offered. Some guy on an other page proposed a solution. I applied that proposed ...
- 351
16
votes
Accepted
Installation error with Composer
Please make sure your webserver (nginx/apache) is using the same PHP version as your cli one. For example, you may encounter this issue if your cli PHP version is PHP 7.1 and your webserver is using ...
- 628
16
votes
Accepted
Notice: Trying to access array offset on value of type null in while installing drupal
I suspect you are installing Drupal (or at least trying to) on a server running PHP 7.4, which is not currently compatible with the latest version of Drupal (8.8). There is an issue on drupal.org ...
15
votes
Does drush need to be installed as root?
NOTE The issue described in the Question has now be fixed in the latest Drush version.
No, Drush does not need to be installed as root.
I've submitted Drush pull #2246 to update the current Drush ...
- 289
14
votes
Drush CC all returning "No Drupal site found, only 'drush' cache was cleared"
There are a few things you can do to help debug your drush. Here is what you can try:
Debug output
Use drush cc all -vvv
This will provide you with some valuable information in terms of what Drush ...
14
votes
Accepted
Error when attempting to create sync directory
Nothing wrong with that.
It is recommend to have the config folder outside of the public web folder; Drupal just doesn't have that. To keep the installation simple for non-experienced users, it puts ...
- 82.2k
11
votes
Accepted
How to install with composer external library that drupal module depends on
You should be able to include this package via composer by adding some repository info.
Add a package definition to your repositories section in your composer.json. The resulting repositories section ...
- 7,472
10
votes
Does hook_install() get called before or after configuration yml files are loaded?
When Drupal install a module, first it installs the default configuration of the module, then it invokes its hook_install(). This is evident from ModuleInstaller::install(), which contains the ...
- 95.7k
9
votes
Accepted
Why does Drupal say I need to upgrade to 8.0.0 beta 6 when I'm already checked out on that tag?
update.module doesn't know about git.
It only understands .info(.yml in D8) files. And .info.yml files only get their version as part of the package building process. If you look at your system.info....
- 82.2k
9
votes
Accepted
How to fix error 'This site can’t be reached' for a site installed on Amazon?
It's because by default port 22 (SSH) comes open in your EC2 security group, but port 80 (HTTP) is not open.
You need to edit your security group. To get there, in your EC2 list, scroll all the way ...
- 30.6k
9
votes
Accepted
How to set the default theme programmatically
The current advice is to set this via config:
\Drupal::configFactory()
->getEditable('system.theme')
->set('default', $theme)
->save();
The previous method using ThemeHandlerInterface:...
- 165k
8
votes
How to get list of module folders which can be deleted safely?
Use this:
drush pmi --fields=type,project,title,status,path --format=table|sort
This gives you a module list with five columns:
First is the type of project: module or theme.
Second one is the ...
- 6,931
8
votes
Accepted
How to recreate the user_picture field?
Instead of importing configuration as suggested previously, you could as an alternative, programmatically re-create the field. Here is some code that does that.
<?php
use Drupal\field\Entity\...
- 8,852
8
votes
Grant permission for custom role from hook_install programmatically
Try this:
use Drupal\user\Entity\Role;
function mymodule_install() {
$role_object = Role::load('my custom role name');
$role_object->grantPermission('my custom permission name');
$...
- 81
7
votes
Accepted
Truncate tables before uninstalling a module in Drupal 8
That's a known issue right now.
There's no way right now to hook into that automatically. And it came up a few times already here too. See this question for example: Module uninstall dependencies
...
- 82.2k
7
votes
Accepted
Does drush need to be installed as root?
Not sure exactly what's going on there but I can reproduce it using the installation instructions.
The problem is related to the execution path (haven't looked any deeper). If you move out of the ...
- 165k
7
votes
Accepted
Managing module library dependencies with composer
New method using drupal-scaffold for greatest flexibility
For Drupal 8.4.0 and greater using drush >9.0.0, drush make is deprecated and you should use a full-composer work flow as detailed in the ...
- 5,806
7
votes
Drush CC all returning "No Drupal site found, only 'drush' cache was cleared"
Noting that your drush status output does give a valid root, site path, database user, and database name, that means that drush is finding a valid settings.php file with credentials in it and can read ...
- 196
7
votes
Accepted
Programmatically build module permission list
You can list all available permissions with PermissionHandler:
$permissions = \Drupal::service('user.permissions')->getPermissions();
You'll find the module name in the provider property of the ...
- 93.7k
7
votes
Install Drupal using composer
Checking https://packagist.org/packages/drupal/drupal for the versions available there is NO 7.x version. Drupal 7 has no composer.json for this to command to work.
You can use one of the other 2 ...
- 1,149
7
votes
Installation error with Composer
For Ubuntu 16.04 I had to run the following commands to adjust the PHP version used by Apache:
sudo a2dismod php7.0
sudo a2enmod php7.2
sudo service apache2 restart
- 425
7
votes
Accepted
How do I programmatically install a module?
Use "module_installer" service.
$installer = \Drupal::service('module_installer');
// Or from the container.
$installer = $container->get('module_installer');
// Install single module.
$installer-...
- 895
6
votes
Accepted
Drupal 8 Equivalent of Drupal 7's disabling a module without Uninstalling it
https://www.drupal.org/node/2225029
The long and the short of it is that you cant. This option is no longer available in Drupal and it was a conscious decision to remove the ability to disable a ...
- 1,500
6
votes
Accepted
Disabling module with config sync and removing with composer
You need two consecutive releases for stuff like that.
First release:
Your colleague uninstalls the module and commits the updated config.
If you don't manage your site via config use hook_update_N ...
- 17k
6
votes
Cannot install Composer because it doesn't contain any .info.yml files
IMPORTANT EDIT (2020-04-28):
You are trying to install this project:
https://www.drupal.org/project/composer
But that is not Composer -- it's a Drush extension for managing Composer.
From the ...
- 2,052
5
votes
Accepted
Will Drupal & Drupal Commerce run under php-cgi?
Core in particular, but also Commerce, is extensively covered by automated tests.
Many of those are also run in a style that simulates a users journey, not only unit tests. So if you run those, you ...
- 27.5k
5
votes
How to get hook_install() to run all hook_update_N()?
The install hook is only called when the module is freshly installed, so there is no need for any updates. The updates are executed only when the module is already installed, so it can apply ...
- 13.9k
5
votes
What causes 'sites/default/files is not writable' during Drupal 7 Install on Redhat w/ Apache?
I thought this would be a SElinux issue with security and I am a bit surprised that your solution worked.
For users with the "common" error, use the following command to provide apache with access ...
- 147
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
installation × 6828 × 160
7 × 158
drush × 73
database × 61
composer × 46
configuration × 32
entities × 31
users × 25
theming × 22
updating × 18
6 × 17
hooks × 17
9 × 17
multi-sites × 16
installation-profiles × 16
commerce × 15
files × 15
distributions × 15
nodes × 13
taxonomy-terms × 8
version-control × 8
acquia-dev-desktop × 7
i18n-l10n × 6
uri × 6