If you do please leave something for me :)
I hope you take something away...
Vue JS Cookie not set in Request Headers
Problem:
I was just learning VueJS and wrote a method to get some JSON data but I noticed that the current session of the user was not sent with the call. My code is as follows
Get Commerce order by product and user
Problem:
I face an uncommon situation where I needed to get the order by the user who is the customer (or the person who ordered the item) and I also had the id of the product i purchased. Usually what happens is we need to find
- What oreders were done by the users
- What products (commerce_products) are in the order etc:-...
Solution:
I had 2 approaches
I need change the location of drupal module
Problem:
I need to chnage the location of an enabled/installed drupal module
Solution:
Easy change the module location Ex (sites/all/modules --->>> sites/all/modules/contrib).
Run the following commands
drush php-eval 'registry_rebuild();'
drush updb -n
.drush cc all
Thats it NO MORE ERROR MESSAGES .....!!!!
What does hook_update_n really do
Problem : How does hook_update_n work in Drupal.
Why we use it: We want to perform a change on a website that is already live. We cannot uninstall and re-enable the module. So we add a hook_update_n
Solution
Well Idealy its all about the naming of the hook SO it goes like this
mymodulename_update_7002
what is 7002?
The differance between self:: and static:: in PHP
Problem : Why would developers use self:: and static:: in PHP OO classes
Solution
Well consider the below code
class Foo { protected static $bar = 1234; public static function instance() { echo self::$bar; echo "\n"; echo static::$bar; } } Foo::instance();
The output will have no difference
1234
1234
But actually there is a difference when using self:: and static::
Drupal 8 and solr with search api - part 1 - Installation and configuration
Implementing a solid search functionality is very important for website developers. In this blog I will discuss
- What the core search module in Drupal 8 can do
- What contributed modules we can use
- Using Solr woth Drupal 8
- Other alternatives
What to do when you realize brew has updated posgresql all of a sudden
Problem:
start postgresql as usual
pg_ctl -w -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Output :
waiting for server to start.... stopped waiting
pg_ctl: could not start server
Examine the log output.
Open the log file to identify the problem
vi /usr/local/var/log/server.log
Log file error
Symfony - assigning a value to a computed field on form submit event
Problem: I have a field in my schema that needs to have a value but I cannot make the user input the value in the form. I have to insert it when I am saving the object instance in the database. I can assign a value for this field using the user entered data in the form. How can I do this
Example: For examples sake say I have a filed called FullName, which I have to assign using the user inputs FirstName and LastName.
So basically FullName = FirstName + " " + LastName.
Solution: Use a event listner provided by the formBuilder object.
Creating a proxy for your frontend application using NGINX
Problem
You have frontend application using a web service to get resources and is running on a gulp/grunt server.
Issues are:
- You will come across CORS errors
- You will have no userfriendly URLS (you will have something like localhost:9090).
How to get rid of these problems?
Easy, just use a NGINX proxy. Here is how
Assumptions:
Enable Outside In experience in your Drupal 8 site
You might have seen the new users experience that Drupal 8 provides. Its provides on the fly block placement and menu configuration. The new experience is called "The outside in experience". Read more about it here. SO however if you are wondering how you can get hands on experience you need to do the following.
Pre-requisites:
You will need to update to Drupal 8.2.0
Modules to enable:
Place Blocks module