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-updates
Response
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/drush
To check your version of Drush, use
drush --version
Status check
drush status
Will 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:
Applying a container using Docker
Running Docker in a new process and creating a container.
Go to the directory using the cd command. In this instance in the sites directory:
cd ~/Sites
Create a new directory, which can be achieved using mkdir
mkdir mydir
If Docker has been installed then the next command will be all that is required
devcontainer
SwiftUI - custom navigation bar title
When managing a navigation title in Swift, you will have trodden down the path. Previously you have entered something like
.navigationTitle("Title")
If you wanted to alter the font used for the navigation area, alter the init() in the view:
How to remove row separators from a Form or List in SwiftUI?
Struggling to hide the SwiftUI separators in a List or Form?
The challenge
Creating the following form, separation lines appeared between NameLayout, FinalPhoto, RawPhoto, ApertureLayout and SubmitButton.