Looking for a TYPO3 or Drupal or mean.io or React expert? Reach me at nirmalya.mondal@gmail.com
Saturday, June 3, 2017
TYPO3: Extending Powermail with New Fields & Conditions with working example to generate PDF File in Frontend.
Powermail is a most powerful editor-friendly, easy to use mailform extension with a lots of features like spam prevention, marketing information, optin, ajax submit, diagram analysis.
Here in this blog i'll explain with an example how to extend Powermail extension in Frontend. Development version is with 3.19.0 - stable. This example should work with other lower versions as its based on Extbase and Fluid Template Engine.
To make this example more usable and demanding i am going to add a new feature to it.
Sometimes we require to generate PDF file with the posted data in the Powermail Form. Say for example you want a form where Frontend Users/ Website Visitors will fill the form and generate a PDF and sign it and upload it again to the server and Send it. i.e. Workflow is like
Form >> Generate PDF by clicking on Generate PDF file with the filled values ( but no submit) >> Print and Sign the PDF then Upload >> Submit the whole form.
We can easily add more steps to this flow or can eliminate any step from here.
Now lets begin with the main matters.
Extension "nirmalya_powermailpdf" has extended Powermail with two additional database fields for form field File and Submit.Those are "signedpdf" to store generated PDF File and "signedpdfbutton" to tell on clicking on which button to generate PDF File.
To Generate PDF File i've used Javascrpt library i.e. jspdf.
More technically there is no php code logic to generate PDF.
By using this library PDF File generation has became super fast!!!
Adding some screenshot from Backend while creating fields for a Powermail Form.
Please Fork this extension from GitHub and use it - extend it - customize it as per your need. I am also happy to hep you more on your requirements.
GitHub: https://github.com/nirmalyamondal/TYPO3-Extensions/tree/master/nirmalya_powermailpdf/
Here in this blog i'll explain with an example how to extend Powermail extension in Frontend. Development version is with 3.19.0 - stable. This example should work with other lower versions as its based on Extbase and Fluid Template Engine.
To make this example more usable and demanding i am going to add a new feature to it.
Sometimes we require to generate PDF file with the posted data in the Powermail Form. Say for example you want a form where Frontend Users/ Website Visitors will fill the form and generate a PDF and sign it and upload it again to the server and Send it. i.e. Workflow is like
Form >> Generate PDF by clicking on Generate PDF file with the filled values ( but no submit) >> Print and Sign the PDF then Upload >> Submit the whole form.
We can easily add more steps to this flow or can eliminate any step from here.
Now lets begin with the main matters.
Extension "nirmalya_powermailpdf" has extended Powermail with two additional database fields for form field File and Submit.Those are "signedpdf" to store generated PDF File and "signedpdfbutton" to tell on clicking on which button to generate PDF File.
To Generate PDF File i've used Javascrpt library i.e. jspdf.
More technically there is no php code logic to generate PDF.
By using this library PDF File generation has became super fast!!!
Adding some screenshot from Backend while creating fields for a Powermail Form.
![]() |
Submit Filed extended with a checkbox to set whether its PDF File Creation button or not. |
![]() |
File Field extended with a checkbox whether it's to store Generated PDF File or not. |
Please Fork this extension from GitHub and use it - extend it - customize it as per your need. I am also happy to hep you more on your requirements.
GitHub: https://github.com/nirmalyamondal/TYPO3-Extensions/tree/master/nirmalya_powermailpdf/
Monday, April 10, 2017
Drupal 8 - Restricting a node content type with access token from viewing.
Now i'll share a Module to alter the existing Drupal "Site Information" form. Specifics:
https://github.com/nirmalyamondal/Drupal-Modules/tree/master/site_apikey
- A new form text field named "Site API Key" needs to be added to the "Site Information" form with the default value of “No API Key yet”.
- When this form is submitted, the value that the user entered for this field should be saved as the system variable named "siteapikey".
- A message should inform the user that the Site API Key has been saved with that value.
- When this form is visited after the "Site API Key" is saved, the field should be populated with the correct value.
- The text of the "Save configuration" button should change to "Update Configuration".
- This module also provides a URL that responds with a JSON representation of a given node with the content type "page" only if the previously submitted API Key and a node id (nid) of an appropriate node are present, otherwise it will respond with "access denied".
https://github.com/nirmalyamondal/Drupal-Modules/tree/master/site_apikey
Tuesday, February 14, 2017
Theming with Drupal 8
|-config
| |-install
| | |-themename.settings.yml
| |-schema
| | |-themename.schema.yml
|-css
| |-style.css
|-js
| |-business.js
|-images
| |-buttons.png
|-includes
| |-bootstrap
| |-flexslider
|-templates
| |-block.html.twig
| |-comment.html.twig
| |-html.html.twig
| |-maintenance-page.html.twig
| |-node.html.twig
| |-page.html.twig
|-favicon.ico
|-logo.png
|-screenshot.png
|-themename.breakpoints.yml
|-themename.info.yml
|-themename.libraries.yml
|-themename.theme
| |-install
| | |-themename.settings.yml
| |-schema
| | |-themename.schema.yml
|-css
| |-style.css
|-js
| |-business.js
|-images
| |-buttons.png
|-includes
| |-bootstrap
| |-flexslider
|-templates
| |-block.html.twig
| |-comment.html.twig
| |-html.html.twig
| |-maintenance-page.html.twig
| |-node.html.twig
| |-page.html.twig
|-favicon.ico
|-logo.png
|-screenshot.png
|-themename.breakpoints.yml
|-themename.info.yml
|-themename.libraries.yml
|-themename.theme
Friday, February 3, 2017
Migration Tutorial: Node Migration from Drupal 7 to Drupal 8
Content Type - Node Migration from Drupal 7 to Drupal 8.
Here i am assuming that you have already gone through my previous blog related to Taxonomy Terms data migration. If not no problem too :)
Say we are developing a module as Custom Migration module with Module key as "migrate_custom".
And yes we'll require to develop this for Drupal 8 :) by maintaining its standard.
migrate_custom will have some dependencies with other modules like Migrate (migrate), Migrate Plus (migrate_plus), Migrate Tools (migrate_tools), Migrate Drupal ...
Lets start with Node Migration with Code Example:
Our aim is to migrate all Node with content type= Blog from d7.blog to d8.blog through a command like
$ drush migrate-import custom_blog --limit="500 items"
Ad per Drupal 8 standard we need a yml file to define everything and a php file to process that yml.
Here is there file/ folder structure
migrate_custom\src\Plugin\migrate\source\Blog.php
migrate_custom\config\install\migrate_plus.migration.custom_blog.yml
In .yml file we define four major parts. These are id, source, process and destination. Id is to identify this Migration process. Source is defined with the data source. Process define basically the mapping of fields in between destination and source.
Inside Blog.php class File extends SqlBase { } with four basic public functions these are
1. query() to fetch data from the source.
2. fields() to defined needed fields.
3. getIds() to get and return fid of File.
4. prepareRow() is basically to set source Property. Here we are settings uri.
A working copy of this Migration is available at Github.
https://github.com/nirmalyamondal/Drupal-Modules/blob/master/migrate_custom/
Here i am assuming that you have already gone through my previous blog related to Taxonomy Terms data migration. If not no problem too :)
Say we are developing a module as Custom Migration module with Module key as "migrate_custom".
And yes we'll require to develop this for Drupal 8 :) by maintaining its standard.
migrate_custom will have some dependencies with other modules like Migrate (migrate), Migrate Plus (migrate_plus), Migrate Tools (migrate_tools), Migrate Drupal ...
Lets start with Node Migration with Code Example:
Our aim is to migrate all Node with content type= Blog from d7.blog to d8.blog through a command like
$ drush migrate-import custom_blog --limit="500 items"
Ad per Drupal 8 standard we need a yml file to define everything and a php file to process that yml.
Here is there file/ folder structure
migrate_custom\src\Plugin\migrate\source\Blog.php
migrate_custom\config\install\migrate_plus.migration.custom_blog.yml
In .yml file we define four major parts. These are id, source, process and destination. Id is to identify this Migration process. Source is defined with the data source. Process define basically the mapping of fields in between destination and source.
id: custom_blog label: Blog node migration from Drupal 7 migration_group: custom dependencies: enforced: module: - migrate_custom source: plugin: custom_blog destination: plugin: entity:node bundle: blog process: # nid: nid # vid: vid type: type langcode: plugin: static_map bypass: true source: language map: und: und title: title uid: uid status: status created: created changed: changed promote: promote sticky: sticky 'body/format': plugin: static_map bypass: true source: body_format map: 1: plain_text 2: restricted_html 3: full_html 4: full_html 'body/value': body_value 'body/summary': body_summary field_highlight: fieldHighlightValue field_image: images |
Inside Blog.php class File extends SqlBase { } with four basic public functions these are
1. query() to fetch data from the source.
2. fields() to defined needed fields.
3. getIds() to get and return fid of File.
4. prepareRow() is basically to set source Property. Here we are settings uri.
A working copy of this Migration is available at Github.
https://github.com/nirmalyamondal/Drupal-Modules/blob/master/migrate_custom/
Saturday, January 7, 2017
Git for Beginners Or Git at a glance.
Git is a "distributed" VCS. You can run it
locally and disconnected from the Internet, and then "push" your changes
to a remote system (such as GitHub) .
It's a source code management system for software development.
A git repository contains, among other things, the following: A set of commit objects. A set of references to commit objects, called heads.
Here i am listing down some Git commands with brief text about what that command does.
It's a source code management system for software development.
A git repository contains, among other things, the following: A set of commit objects. A set of references to commit objects, called heads.
Here i am listing down some Git commands with brief text about what that command does.
1. Remove Git Tracking
$ rm -rf .git
2. Show Origin of the repository
$ git remote show origin
3. Adding files to Git
$ git add <filename>
$ git add *
$ rm -rf .git
2. Show Origin of the repository
$ git remote show origin
3. Adding files to Git
$ git add <filename>
$ git add *
4. Commit files
$ git commit -m "Commit message."
$ git commit -a
5.Status i.e list the files you've changed and those you still need to add or commit:
$ git status
6. Push i.e.send changes to the remote master branch of your remote repository:
$ git push origin master/dev/prod/branchName
7. Connect to a remote repository to be able to push to it:
$ git remote add origin <server>
8. List all currently configured remote repositories
$ git remote -v
9. List all the branches in your repository, and also tell you what branch you're currently in:
$ git branch
10. Create a new branch and switch to it:
$ git checkout -b <branchname>
11. Switch from one branch to another:
$ git checkout <branchname>
12. Delete the feature branch:
$ git branch -d <branchname> (not the remote branch!)
13. Push the branch to your remote repository, so others can use it:
$ git push origin <branchname>
14. Push all branches to your remote repository:
$ git push --all origin
15. Delete a branch on your remote repository:
$ git push origin :<branchname>
16. Fetch and merge changes on(from) the remote server to your working directory:
$ git pull
17. To merge a different branch into your active branch:
$ git merge <branchname>
18. View all the merge conflicts:
$ git diff
19. View the conflicts against the base file:
$ git diff --base <filename>
20. Preview changes, before merging:
$ git diff <sourcebranch> <targetbranch>
21. Tags. You can use tagging to mark a significant change set, such as a release:
$ git tag 1.0.0 <commitID>
22. Push all tags to remote repository:
$ git push --tags origin
23. Git add remote upstream
$ git remote add upstream https://github.com/nirmalyamondal/Drupal-Modules.git
24. If you want to see more information about a particular remote, you can use the git remote show [remote-name] command.
$ git remote show origin\
25. Undo local changes
If you mess up, you can replace the changes in your working tree with the last content in head:
Changes already added to the index, as well as new files, will be kept.
$ git checkout -- <filename>
26. Check the log of the Git commit
$ git log
27. Tell Git who you are
git config --global user.name "Nirmalya Mondal"
git config --global user.email nirmalya_email@domain.com
git config --list
28. Create a new local repository
$ git init
29. Instead, to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it, do this:
$ git fetch origin
$ git reset --hard origin/master
30. Check out a repository
$ git clone /path/to/repository
$ git clone username@host:/path/to/repository
31. Removes all removed remote branches
$ git fetch --all --prune
32. Stashes the local changes, so they can’t be lost during a git pull.
$ git stash
33. Restores the changed files from the stash and tries to merge them.
$ git stash apply
34. Reverts an commit that is already committed and pushed.
$ git revert <hash>
35. Removes the given files from the remote repository
$ git rm <file1> <file2>
Don't be confused with pull and fetch command. In the simplest terms, git pull does a git fetch followed by a git merge.
Git's Workflow that i follow is like -
-------------
Forking the repository -> cloning it -> creating feature branches -> committing changes -> submitting pull requests.
-------------
Forking the repository -> cloning it -> creating feature branches -> committing changes -> submitting pull requests.
-------------
More commands to be added soon ...
Some useful Ubuntu commands we use frequently.
There are some Ubuntu commands we use very frequently and its harder to remember these all. To avoid searching over the net i am writing those down here precisely for reference so that i can have a look at it anytime.
1. Setting file permissions to 664 recursively -
$ find . -type f -exec chmod 664 {} \;
2. Setting folder permissions to 775 recursively -
$ find . -type d -exec chmod 775 {} \;
3. Delete files folders recursively -
$ rm -rf folderName
4. Search for a "string" in your system -
$ grep -nr "string"
5. Generating An ISO file From A Folder
$ mkisofs -o image.iso -R /path/to/folder/
$ mkisofs -o image.iso -R $HOME (for home directory)
6. Download and extract Tar file in a command
$ wget url-to-tar-file -O - | tar xfz -
$ wget http://website.com/project/tarFile_4.7.tar.gz -O - | tar xfz -
I also prefer dtrx to unzip files. Because with a single command you can unzip any zipped file format.
To install that use this command
$ sudo apt-get install dtrx
7. Killing a halted process
Top command to list down all process with its id.
$ top
$ kill -SIGKILL procesid
Or we can use this command below as well
$ kill -SIGTERM procesid
8. Symlink through command
To create a symlink at /foo/bar which references to file /usr/bin/bar use this command below
$ ln -s /usr/bin/bar /foo/foo
9. Reading file say error log of Apache webserver
$ tail -f /var/log/apache2/error.log
10. Export Import mySql data file -
$ mysqldump -u root -p password databaseName > database_filename.sql
Many more to add ...
1. Setting file permissions to 664 recursively -
$ find . -type f -exec chmod 664 {} \;
2. Setting folder permissions to 775 recursively -
$ find . -type d -exec chmod 775 {} \;
3. Delete files folders recursively -
$ rm -rf folderName
4. Search for a "string" in your system -
$ grep -nr "string"
5. Generating An ISO file From A Folder
$ mkisofs -o image.iso -R /path/to/folder/
$ mkisofs -o image.iso -R $HOME (for home directory)
6. Download and extract Tar file in a command
$ wget url-to-tar-file -O - | tar xfz -
$ wget http://website.com/project/tarFile_4.7.tar.gz -O - | tar xfz -
I also prefer dtrx to unzip files. Because with a single command you can unzip any zipped file format.
To install that use this command
$ sudo apt-get install dtrx
7. Killing a halted process
Top command to list down all process with its id.
$ top
$ kill -SIGKILL procesid
Or we can use this command below as well
$ kill -SIGTERM procesid
8. Symlink through command
To create a symlink at /foo/bar which references to file /usr/bin/bar use this command below
$ ln -s /usr/bin/bar /foo/foo
9. Reading file say error log of Apache webserver
$ tail -f /var/log/apache2/error.log
10. Export Import mySql data file -
$ mysqldump -u root -p password databaseName > database_filename.sql
$ mysql -u root -p password -h localhost databaseName < database_filename.sql
Many more to add ...
Subscribe to:
Posts (Atom)