In Drupal 8, third party libraries are downloaded and managed via composer. In Drupal each project must contain only one vendor folder. Composer Manager allows single vendor/directory shared across all modules which prevents code duplication and version mismatches by merging the requirements of all the found modules into the consolidated composer.json file.
This article covers, how to send email programmatically in your Drupal 8 site. There are two main steps to send an email using Drupal 8. First we need to implement hook_mail() to define email templates and the second step is to use the mail manager to send emails using these templates. Let's see an example for sending an email from the custom module, also the following name spaces.
In one of my Drupal 8 work I needed to configure SMTP using swiftmailer Module. The module extends the basic mail sending functionality which is provided by Drupal by delegating all mail handling to Swift Mailer library. This library provides features, such as :
In Drupal 7 we can upgrade a module in many ways but we fail on upgrade feeds excel module. The reason being the newer version of the module is entirely different from the old version folder structure and file naming. We can overcome this situation by uninstalling the older version and installing the new version. Sometimes we cannot uninstall the module due to the module dependency and data lock. We can achieve this manually using the following steps.
In Drupal 8, variable_set() and variable_get() is deprecated. The variables database table in Drupal 7 is now removed in Drupal 8, and is replaced with config table. We can create a variable while installing the module using MODULE.setting.yml and MODULE.schema.yml files.
One of our project requirement was to transfer files from our server to an external storage space. This could be basically done by connecting to the server using SSH or FTP and then transferring files. We initially decided to use the libssh2-php library for creating SSH tunneling with the server and transfer file. Our server was hosted in Acquia server and libssh2-php was not available in Acquia stack. Read on to know how we tackled the problem of file transfer to an external storage space in Acquia environment.
We have been involved with the Drupal Open Curriculum initiative under the Curriculum and Training group in groups.drupal.org for the last few months and have been helping build up the content for the initiative.
We are happy to inform that, we have completed the the first phase of the project on creating a standardized Drupal curriculum for Drupal companies as planned. We have compiled and published our Drupal training curriculum on the groups.drupal.org wiki under the Curriculum and Training group. We are now looking to get feedback from other Drupal companies and Drupal developers on the curriculum and the training materials. We also would like to invite developers from the community to contribute towards making this curriculum better.
A Payment gateway tends to offer multiple types of payment services, that provides onsite and offsite options. Onsite payment is processed by a third party API using web services with the information gathered from our site through a checkout form (For example : Credit card/Debit card credentials). Offsite payment method, on the other hand, processes data entered in the payment gateway page. It redirects the users to the processing page of the payment gateway using the checkout form. After the payment is completed, the user will be redirected to the payment page, from where the user can move forward or backward in the checkout process. Here, let's take a look at the creation of custom offsite payment gateway module.
As one of the largest exclusive Drupal agencies in India and having trained close to 200 employees over its 10 year history we are probably one of the very few Drupal firms in India in a position to take this effort that could in turn help a lot of other Drupal companies. We are looking to compile and publish our Drupal Training Curriculum in an effort to come up with a standard approach towards training developers in Drupal companies. We are looking to complete this exercise by March 31, 2016 and will be publishing the learning objectives, syllabus and curriculum under GFDL license.
SSH keys are a way to identify computers, without using passwords. If you have used git, or if you are an active participant in the open-source community, you will be definitely familiar with the important role of SSH. In the case of remote servers, when using SSH logins, the server will ask for password each time you try to login. This could be avoided by adding public key to server's authorized_keys.
With Drupal 8 just around the corner, every Drupal developer is in a nirvana of excitement and eagerness. Drupal keeps getting better and better every day and Drupal 8 will make website development and management a five-finger exercise, because this latest version of Drupal has included some amazing and potent Symfony components to serve the big businesses better.
To keep the default values of the step one form after successfully submitting the step 2 form, here is an easy way. Just pass the form state values of step 1 form as query parameters to the same page on submitting step 2 form. Set the default values of step 1 form as, first check whether the form_state value is set. If yes, set the default values of step 1 form fields with the form_state values. Else check the URL query parameters, whether this variable is set. If yes, then set the default value with that value.
We can use l() to add links in our Drupal pages. However, while using the output of drupal_get_destination() in the l() as link, it might end up in the wrong functionality. If the drupal_get_destination() returns a url with parameters involved, then using it directly in the l() would cause the link to redirect to the wrong page.
This article explains how to replace tokens to webform, views, blocks and Drupal forms from the node body. The preg_replace function for replacing the tokens. The preg_replace function works in the same way as preg_match. preg_replace is used to search a regular expression and replace it.
In one of my Drupal projects, I had a requirement to submit data from a webform to an external application. hook_webform_submission_insert() helps to meet my requirement. In your custom module, call the hook function hook_webform_submission_insert().
While working on a Drupal 6 project, I came across the requirement to send some mails. Interestingly, I couldn't find any good articles or procedures on the same. So, here, I am going to explain how to send mails in Drupal 6 with attachments. If you need any business support, get in touch immediately.
The drupal_write_record function is used to insert or update a record in the database based on the schema of the table. It helps in executing less database query. Let's take a look at the function given below.