Joomla! - global check-in
There are times when other Joomla! administrators of the site leave a page without tapping one of the methods to close it... save & close or close. Subsequently, when a page hasn't been closed, a padlock appears to prevent another administrator's accessing the page(s) to make changes. Great for content management, not so great if the person is uncontactable.
Drupal resolving a white screen of death
On a git pull from remote dev environment to a staging environment running off AWS server... I was greeted with the white screen of death. While it took me a while to resolve the actual issue, my action plan was as follows:
How to resolve:
- Look in your log files;
- Add a few lines to your index.php file
Drupal URL links programmatically
Creating URL's in Drupal programmatically:
Internal path
use Drupal\Core\Link;
use Drupal\Core\Url;
$internal_link = Link::fromTextAndUrl(t('Drupal nodes'), Url::fromUri('internal:/node', $options))->toString();
External Url
use Drupal\Core\Link;
use Drupal\Core\Url;
$external_link = Link::fromTextAndUrl(t('Codebales'), Url::fromUri('http://www.codebales.com/'))->toString();
Terminal does a file exists using PHP
I needed the check if a file existed in a directory as the migrate script wasn't recognising the file. To check if a file exists:
FILE={your-directory-path}
if test -f "$FILE"; then
echo "$FILE exists."
fi
If your directory path is /Users/{your name}/Sites/migrate/local_dest_dir/fish/../media/apple-store.png
Solving the Error: Call to a member function getFileUri() on null
I was trying to create something quite simple. How to get image file uri from media entity id or rendered entity.
Or other variations you might have searched:
- How to load existing media programmatically
- How to get image file uri from media entity id
- Call to a member function getFileUri()
- drupal File::load getFileUri
- drupal getFileUri
Drupal twig look up to access field data
This guide has been compiled as a reference tool on how to access field values for different field types.
The Manage Display admin UI can change how a field’s label and content are displayed. When I want to show how to output just the Manage Display version of the content, I use the word ‘display’. When I’m talking about the more raw version of the content, I use ‘value’.
Mismatched entity and/or field definitions
Have you come across the following Drupal error message:
Mismatched entity and/or field definitions. The following changes were detected in the entity type and field definitions.
Run a database update status check
drush updatedb:status --entity-updatesResponse
common Drush commands
If your Composer project doesn't have Drush listed as a dependency, you can install Drush from command line as follows:
composer require drush/drushTo check your version of Drush, use
drush --version
Status check
drush statusWill output something similar to
Setting up a new local site environment
Setting up a new project in Docker and VS Code.
Using Terminal, go to your Sites directory and create a new directory using the mkdir command. In this instance I'm going to create a new directory titled ADCE
shortcut command to access the Sites directory
cd ~/Sites
Create the new directory
mkdir ADCE
Go in to the new directory
cd ADCE
Run the devcontainer command
Onboarding
Joining a new company / team there is always a lot of new items to do, install and familiarise yourself. Below is a working list: