Drupal - How do I programmatically set contextual filters?
If you are like me, almost every view I have will have this filter. So I regularly have the need to set a contextual filter programmatically. However, some won't and will have other contextual filters instead.
You can pass through the $view object the contextual filter params using the setArguments() method. Say you want to pass three node nids to the view to filter the results contextually:
Drupal 9 adding a reCAPTCHA element to a webform
JSON structure
Outlining the structure of the elements common attributes: type, title, name and required;
Text area
{
"type": "webform_multiple",
"title": "What's new?",
"name": "what_s_new_",
"required": false
}Text field
An additional attribute for the text field is maxlength
Decoupled Drupal 9 with React front-end using search
How to make React calls on a Drupal 9 backend site using the search functionality
Tools
| Drupal | 9.4 |
| React |
The sample sent through from the front-end is as follows:
Adding icon and type elements to the JSON output for React frontend
Working on a decoupled React / Drupal 9 site.
Aim: Adjust the output of curated content for the Work Resources page. So the icon is displayed with a path. Enabling React developers to select whether to use the image or icon.
Tools
| Drupal | 9.4 |
| React |
How to get the node.nid from the alias
In this instance, I'll check the beginning of the string. I want to focus on the href's that start with /node/. Which has been added using the variable $catchPhrase.
Using the Drupal service path_alias to return the node.nid as follows:
Microsoft Teams - not opening on MACOS - how to delete cache of Microsoft Teams on macOS?
Trying to have a chat recently, and Microsoft Teams would not open on MAC OS. Sometimes it would open without issue. But today, no play.
The email comes through with no issue. Opens in Safari with no issue. But the link to open in Microsoft Teams, goes nowhere.
Below are the progressive steps that I took to resolve this issue (note that this could take multiple solutions - let's see):
ERROR Error: Uncaught (in promise): TypeError: undefined is not an object
ERROR Error: Uncaught (in promise): TypeError: undefined is not an object (evaluating 'ce.imageURL')
git fatal: The current branch {} has no upstream branch
When attempting to do a git push, are you getting the following response:
fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin main
Quick solution, instead run the command
git push origin mainAnd the response will push what you were attempting to do
Recently viewed pages
This code is from Drupal 9 back-end for a React front-end via REST API.
Working through the output for recently viewed pages... the code structure:
How to remove .DS_Store from your git repo
Working from the bases that .DS_Store has not been added to your git repository, then you can add it to your .gitignore file.
touch .gitignoreIn the .gitignore file add the following
# Hide the DS_Store files
**/.DS_StoreHowever, if it's already there, then in Terminal you will need to write: