Articles

/themes/custom/zyxpro_light/images/placeholder.png
17th December 2018 Bootstrap , Drupal
close

on 17th December 2018 / by akhila.vn
I had a requirement to add a multi-level responsive drop down menu in a Zyxware theme. Please do refer the below reference links to know more about responsive themes and free Drupal themes. So for that I had to edit page.tpl.php, page--front.tpl.php, style.css, template.php etc. First I added the following code to template.php of my theme. The steps that I followed here are, Added the following code to the function themename__preprocess_page(&$vars) to make the menu as a tree. //Setting menu in a tree structure $main_menu_tree = menu_tree(variable_get('menu_main_links_source', 'main-menu')); $vars['main_menu'] = $main_menu_tree; // Get the entire main menu tree $main_menu_tree = menu_tree_all_data('main-menu'); // Add the rendered output to the $main_menu_expanded variable $vars['main_menu_expanded'] = menu_tree_output($main_menu_tree); Added css class to main menu using the function, function themename_menu_tree__main_menu(&$vars) { return '<ul class="nav navbar-nav">' . $vars['tree'] . '</ul>'; } Added css class to inner part of main menu using the function, function themename_menu_tree__main_menu_inner($vars) { return '<ul class="dropdown-menu">' . $vars['tree'] . '</ul>'; } Added the following function to display the links in main menu tree, function themename_menu_link__main_menu($vars) { $element = $vars['element']; $sub_menu = ''; if ($element['#below']) { foreach ($element['#below'] as $key => $val) { if (is_numeric($key)) { $element['#below'][$key]['#theme'] = 'menu_link__main_menu_inner'; // 2 level <li> } } $element['#below']['#theme_wrappers'][0] = 'menu_tree__main_menu_inner'; // 2 level <ul> $sub_menu = drupal_render($element['#below']); } $output = l($element['#title'], $element['#href'], $element['#localized_options']); $element['#localized_options']['attributes']['class'][] = " dropdown-toggle "; $element['#localized_options']['attributes']['role'][] = "menu"; $element['#localized_options']['attributes']['data-toggle'][] = "dropdown"; $element['#localized_options']['attributes']['aria-expanded'][] = "true"; $output = l($element['#title'], $element['#href'], $element['#localized_options']); return '<li class="dropdown">' . $output . $sub_menu . '</li>'; } Added the following code to make inner <li> tag - links function themename_menu_link__main_menu_inner($vars) { $element = $vars['element']; $sub_menu = ''; if ($element['#below']) { $sub_menu = drupal_render($element['#below']); } $output = l($element['#title'], $element['#href'], $element['#localized_options']); return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . '</li>\n'; } Then I added the code ' print render($main_menu); ' to the page.tpl and page--front.tpl for display menu with necessary <div> tag and css styles based on the theme that were downloaded from http://getbootstrap.com/components References : https://www.drupal.org/node/1178784 http://getbootstrap.com/components/ http://www.zymphonies.com/metro-responsive-theme Bootstrap Drupal Leave a reply Your email address will not be published. Required fields are marked *
/themes/custom/zyxpro_light/images/placeholder.png
17th December 2018
close

on 17th December 2018 / by webmaster
Introduction A client approached us to add a feature to a site they were building. The site was to be an auctioning platform for football players. Among other enhancements, we worked on a registration confirmation feature. Many of the features in the site like registration, negotiation and other communications are based on an emailing system. Problem Identification The emails that were going out of the site were being marked spam and not being delivered to the intended recipient’s inbox. Another issue was that the number of emails sent daily got limited to 500 emails, Google’s email delivery limit. Problem Research When sending out emails through Gmail or via an email app, emails get routed through sender email service's SMTP service to the recipient’s SMTP email service. This is the normal way of sending emails, but even in this some emails were getting labeled as spam. Nowadays, most email apps strictly scan emails to remove spam, and one of the main things they use to filter out spam messages is the IP address that is used to send the emails. They check against both blacklists as well as whitelists. If we are sending emails from a shared server, there's a possibility that our IP address is already on those blacklists. If we have our own IP address, our mail still may get marked as spam, which means we are on a blacklist. If our site is not associated with a reputable or identifiable IP address and domain name, most email providers will mark it spam. We will also need an SPF or DMIK record, email validation tool that may be difficult to implement on our own but is included with most email sending services. On consideration, we found that transactional email services were a good option in those cases. Approach Why we chose transactional email sending services? Below are three situations (reasons) when transactional email services are the best options: Sending more messages, faster Gmail has a cap (capability) of 500 emails a day, a common limitation we face with email servers. Many shared hosting services also limit the number of emails that can be sent per day. With transactional email sending services, we can send from 10 emails a minute to even 10 million a month. Either way, the email service will be ready for our load, without any added effort from our side. If we need to send thousands of emails a day through our app, or say deliver our company's newsletter to millions of people, we need to think a lot more about how our emails are to be sent. We need a transactional email service, a dedicated email sending service that'll make sure our emails are delivered no matter how many we send. Ensuring your messages get delivered Even if we choose our own servers, and have the infrastructure to send the messages we need, another potential problem we can face with owned email sending server is deliverability. We may technically be able to send emails on our own, but the probability of those emails showing up in our recipients' inboxes is close to nil. Doing more with our emails Some transactional email services, such as Amazon SES, are focused only on sending the email and thus priced accordingly. But most other transactional email services include advanced stats, notifications, filtering and other features which can’t be done using normal email services. With a bit of coding, or with just some clicks on the stats dashboard, we can do amazing things. Solutions Depending on the ease of use, the stats dashboards, and other features we need we can select the right email sending service. The most simple and cheapest transactional email service is Amazon SES, it sends emails, and little else. Others like SendInBlue, Mandrill etc have features like SPF and IP address mapping, template hosting, reports, and analytics, etc, but they are often more expensive, even though your requirement might involve sending comparatively lesser number of emails. Depending on the features, one service may be better suited for our needs and by trying out the most suitable ones, we can see which works best with our apps and workflow and then standardize it. Why SendGrid integration with SMTP module was chosen? One of the biggest transactional email service providers is SendGrid. It delivers over 15 Billion emails each month for their clients. Some of their regular clients are Uber, Spotify, Airbnb and Glassdoor. SendGrid gives real-time analysis to optimize the performance of our email marketing campaign. With powerful segmentation and Contact Management tools we can simply send straightforward mail to a targeted and relevant audience. SendGrid can handle massive email campaigns while providing highly detailed and flexible reporting, along with the ability to scale and increase deliverability, so we went with it. Key features Offers high email delivery to make sure our emails get delivered. Allow us to analyze the results of the sent emails like number of opens, clicks, bounce, etc. We can use Engagement Segmentation feature to group customers by how much they engage with messages. We can also edit the transactional email templates either with the drag n drop editor, HTML or CSS. We can build our own preview design and template with SendGrid to ensure that our emails are displayed beautifully and are well crafted. We can open our Sendgrid account and other reports in the mobile phone. Project Implementation Create a SendGrid Account After signing up for an account, we can select a plan that meets our business needs. After receiving a confirmation email, sign in to the SendGrid account. From within the Settings menu, click Credentials. This is where we can create site-specific credentials so that sites have their own unique access to our SendGrid features and mail. Once we have created our site's credentials, we gain the desired access (UI/API and Mail). Integrating Sendgrid With Drupal Follow the procedure specified below for Drupal CMS. There are two methods that can be used to integrate SendGrid with a Drupal 8 site: API or SMTP. SendGrid SMTP Integration Install the SMTP Authentication Support module using Composer. Visit /admin/config/system/smtp once you've logged in as an administrator. From within Install Options, select On. Use the following within SMTP Server Settings: SMTP server: smtp.sendgrid.net SMTP port: 2525 Use encrypted protocol: We strongly recommend selecting TLS Provide your site-specific SendGrid credentials and click Save configuration. The Drupal application is now ready to send emails through SendGrid. Provide an address within the Send Test E-mail configuration field and click Save configuration to test. Checking deliverability in SendGrid For testing purposes, our first few deliveries had be to email addresses that we could verify directly. We tracked and measured unique aspects of mail behaviors from within our site's SendGrid account, which we monitored. For that first, we logged into SendGrid and selected Activity. It will take us to a page with a form to search by email. Enter the email address, and press Enter. SendGrid will search through our mail queue for any messages sent to that address. For additional search parameters, select the filters near the top right corner. Implementation Result Since the site registration, products reachability, both internal and external communication etc. are through emails, the mailing system plays a very important role in the business process. With the integration of sendGrid in the site, there are no longer any issues of the emails not reaching the recipient's inbox. The clients also benefited from the extra features that came with the integration of SendGrid.
/themes/custom/zyxpro_light/images/placeholder.png
17th December 2018 Drupal 8
close

on 17th December 2018 / by akhila.vn
In Drupal 8, the usage of database operations such as select, update and delete are slightly changed from Drupal 7. The db_query() is deprecated in Drupal 8. To fetch a field we can use : $query = \Drupal::database()->query('SELECT myfield from my_table where field1 = :value1 AND field2 = :value2', array( ':value1' => $condition1, ':value2' => $condition2, ) ); $data = $query->fetchField(); Now we can checkout the select, update, and delete operations in Drupal 8. For a field selection use, $query = \Drupal::database()->select('table_name', 'alias') ->fields('alias', ['field1', field2]) ->condition('field3', $condition); $results = $query->execute(); while ($content = $results->fetchAssoc()) { // Operations using $content. } For a single field selection we can use $last_paper_id = $last_paper->fetchField(); For update query execution in Drupal 8, we can use, $table = 'table_name'; \Drupal::database()->update($table) ->fields(array('field1' => $value1, 'field2' => $value2)) ->condition('field3', $condition1) ->condition('field4', $condition2) ->execute(); For content deletion, $query = \Drupal::database()->delete('table_name'); $query->condition('field1', $condition1); $query->condition('field2', $condition2); $query->execute(); Now checkout other database statements in Drupal 8 from this link! Drupal 8 Leave a reply Your email address will not be published. Required fields are marked *
/themes/custom/zyxpro_light/images/placeholder.png
17th December 2018 HubSpot
close

on 17th December 2018 / by fathimath.sajila
We can send email through HubSpot CRM using SMTP API. For sending email SMTP, first we need to create the SMTP tokens. Generate SMTP API Tokens An API token provides both a username and password which can then be used to send email through the HubSpot SMTP APi. We can create SMTP token using the API link below. https://api.hubapi.com/email/public/v1/smtpapi/tokens?hapikey=demo Example: Use the following code for generating json code, $post_arr = array( 'createdBy' => 'demo@hubspot.com', 'campaignName' => 'Transactional Email For Test' ); $post_json = json_encode($post_arr); $hubspot_api_url = 'https://api.hubapi.com/email/public/v1/smtpapi/tokens?hapikey=demo'; $response = drupal_http_request($hubspot_api_url, array('Content-Type' => 'application/x-www-form-urlencoded'), 'POST', $post_json); A sample json response is shown below, { "userName": "asdfghjkl@11111.smtp.hubspot.net", "password": "3432fff8eljl1249fjjasdfnv3", "portalId": 11111, "emailCampaignId": 14862038, "createdAt": 1415660606232, "deleted": false, "createdBy": "abcd@hubspot.com", "appId": 22709, "campaignName": "Test Transactional Email" } From there we get the SMTP Hostname, SMTP Port, SMTP User Name,SMTP Password. Now we can send email through HubSpot CRM using these SMTP values. HubSpot Leave a reply Your email address will not be published. Required fields are marked *
/themes/custom/zyxpro_light/images/placeholder.png
17th December 2018 Mac mini
close

on 17th December 2018 / by smitha.vn
Most of the projects that we work on involve either development or testing on MAC. It is, therefore, essential to know the keyboard shortcuts for MAC. Often the novices find it extremely difficult to garner the required information (in the case of PC Keyboard for MAC), so to make things easy the commonly used MAC commands are compiled and listed in this section. Before moving on to the shortcuts, the user should be familiar with the keyboard equivalents. The PC equivalent of the MAC keys are as follows : Windows Control Key > MAC Command key Windows Alt Key > MAC Option key Windows Enter key > MAC Return key Windows Backspace key > MAC Delete key Now let's go through the commands. Command-X -> Cut the item to remove it. Command-C -> Copy the selected item. Command-V -> Paste the contents. Command-Z -> Undo the previous command. Command-Shift-Z -> Redo action for reversing the undo command. Command-A -> Select all items. Command-F -> Find items in a document. Command-N -> Open a new window. Command-S -> Save the current document. Command-Q -> Quit the app. Option-Command-Esc -> Choose an app to force quit. Shift-Command-3 -> Take a screenshot of the entire screen (The screenshot will saved as a .png file on your desktop). Control-L -> Center the cursor or selection in the visible area. Option-Command-I -> Show or hide the inspector window. Shift–Left Arrow -> For extending the text selection one character to the left. Shift–Right Arrow -> For extending the text selection one character to the right. Shift–Up Arrow -> For extending the text selection to the nearest character at the same horizontal location on the line above. Shift–Down Arrow -> For extending the text selection to the nearest character at the same horizontal location on the line below. Command–Up Arrow -> For moving the insertion point to the beginning of the current document. Command–Down Arrow -> For moving the insertion point to the end of the current document. Command–Left Arrow -> For moving the insertion point to the beginning of the current line. Command–Right Arrow -> For moving the insertion point to the end of the current line. In order to rename an item, select the item and click Enter key and type. Hope this helps! Mac mini Leave a reply Your email address will not be published. Required fields are marked *
/themes/custom/zyxpro_light/images/placeholder.png
17th December 2018 App Development , Ecommerce
close

on 17th December 2018 / by jake.rheude
Next time you’re in a crowded location, count out ten people. Eight of them will have used a mobile device for online shopping, and at least three will do all their online shopping solely on that mobile device1. If you’re an e-commerce store owner, the eight are great news. However, those three might be giving you some anxiety because you’re not sure the best way to reach them. You’ve heard about the promise of mobile apps and the benefits of a responsive website but aren’t sure where to put your development dollars. Not to worry, we’ll look at the core features of each and give you some suggestions that’ll make the choice a bit easier based on your brand and target markets. What’s Up with Native Apps? You’re probably familiar with apps on your phone, whether they’re called mobile or native apps. A native app is one that was built specifically for an operating system and sometimes is adjusted for an individual device. Such development enables the app to use the specific hardware and features of the mobile device, like its accelerometer, GPS, email, social apps, camera, and more. For an e-commerce brand, an app can be both an online store and a way to view a customer account. Your user will fire up the app and have access to their order history, current order status, and be able to shop your store, among other things. It can be anything from Amazon’s app to your local veterinarian’s app that allows you to refill your pooch’s flea prevention with just a click. The wonderful thing about an app is that you can completely control it. You get to set up the entire user interface, options, notifications it delivers, and so much more. Because an app is downloaded and tied to a specific account, it means you can collect a lot of customer data and show that individual user the offers and coupons most relevant to them. Personalization is at the heart of this interaction, which could increase your chance of sales. The other major benefit is that apps can automatically deliver information to your users, such as deals. Notifications are easy to view, and a single click gets them right to your content. Plus, if you combine this with email marketing, you get multiple chances to reach someone with a personalized offer. The big downside with an app is that you must create multiple versions for different operating systems, and sometimes different phones. There’s a whole lot of testing, and it is continuous. You must ensure the app works on all platforms whenever you make an update and review it across impacted devices whenever there is an update to a major operating system. Two requirements for an app to be successful are: It has to work whenever the user clicks, andYou have to make a compelling enough offer that they open your app consistently.Does a Responsive Website Make Sense? Responsive design is among the most favored design styles right now because it allows you to create once for any screen size. In this architecture, your website automatically arranges itself based on the width of the browser. It prioritizes content and moves things around when you’re working on a mobile device and makes the layout appear as clean and useful as possible. The great news here is that this is automatic once your site is live. You use rules to define how this all reacts, and the site takes care of the rest. It allows you to build once for use on any browser of any size. It’ll even respond when someone on a PC has their browser window maximized or smaller. Dynamic movements can be difficult to plan out, so there’s plenty of testing before your site goes live. The good news is that you don’t have to do much testing and reconfiguring once you’re happy with it. The main testing elements are when you decide to incorporate additional content, plugins, or pages with your website — you want to make sure that new chatbot doesn’t block photos on the mobile version while also isn’t too small to be seen on a desktop browser. For today’s apps, there are a variety of plugins that you can use for things like shopping carts. However, in general terms, it will usually be easier for you to add new features and support for third-party tools on a website because there’s less custom code. Shoppers will appreciate the fact that they don’t have to download a specific app to see your content and that they can buy however they want. If they see something on their phone but aren’t comfortable using a credit card on it, they can simply navigate to your site on their laptop and make a purchase. If you’ve got customer accounts where they can sign in and save a shopping cart or items to a wish list, you’ve just made it that much easier to make a purchase on a preferred platform. The major downside for a website is that it isn’t as interactive as an app and you can’t always support things like gestures or advancement movements through the accelerometer. You’ll also have to get people to sign up for emails to broadcast to reach them; there’s no inherent messaging like you get on an app. How Do You Pick What’s Best? Two factors guide the decision for a responsive website or an app: money and audience. If you can afford the development of a custom app, and you have an audience that has demonstrated a desire to shop on an app, then that’s definitely a good reason to go for it. The cost for developing your own app will depend on your requirements. Beyond that initial cost, there’s another thing to consider about your app: not everyone is going to download it. If one of your brand’s core cultural aspects is exclusivity, then that’s great. If not, you’ll have to get a website anyway, and it’ll most likely be responsive. Responsive websites are relatively inexpensive and, today, there are plenty of tools and services you can use from third parties to do things like improve your shopping cart, add lookbooks, link to CRM and order management tools, and much more. For your app, some partners have APIs that you can use, but you’ve got more custom development here too. A responsive website is always a must-have in today’s environment. A great app is a perfect way to maximize sales through direct personalization if you can afford that development pricing and have a hungry audience. Reference 1. https://www.statista.com/topics/1185/mobile-commerce/ App Development Ecommerce Responsive Design Leave a reply Your email address will not be published. Required fields are marked *
/themes/custom/zyxpro_light/images/placeholder.png
17th December 2018 Mobile Applications , Mobile Testing
close

on 17th December 2018 / by aswathy.s
Running multiple iOS Simulator instances is very helpful for testing purposes. This is helpful in testing same application on different devices simultaneously or with different user credentials simultaneously. The default behaviour does not allow to run more than one simulator instance from XCode. But it is possible to do it from the command line.   For this change the directory into Developer/Applications in XCode.app package and run simulator with the "open" command.   cd /Applications/Xcode.app/Contents/Developer/Applications open -n Simulator.app open -n Simulator.app When the second simulator instance launches you’ll get an error message saying “Unable to boot device in the current state: Booted”. Dismiss the error message and proceed with the test. Device hardware type can be changed from "Hardware >> Device" menu of the iOS Simulator. Mobile Applications Mobile Testing Leave a reply Your email address will not be published. Required fields are marked *
/themes/custom/zyxpro_light/images/placeholder.png
17th December 2018 Drupal 8 , Drupal 7
close

on 17th December 2018 / by akhila.vn
For upgrading any of your contributed Drupal 7 modules, you just need to follow the few steps shown below. First of all you have to make sure that Drush is installed. If not installed, follow the steps from here. Now install a fresh Drupal 8 in your system using Drush commands or directly download from Drupal.org. You must be aware that Drupal 8 has changed its structure from Drupal 7 in configuration, theming, folder structure etc. So now we can find the contributed and custom modules in the modules folder in the root directory. It is also better to create a contrib folder in modules folder for both DMU (Drupal Module Upgrader) and your Drupal 7 module for migration. And now let's have a look at DMU. Drupal Module Upgrader is a script that scans and upgrades the source code of your Drupal 7 module, it also generates a list of new fixes with information links to Drupal.org as an upgrade-info.html file that will be available in your upgrading module directory. Also note that, this DMU scripts will run using Drush and Composer. Now get into your Drupal 8's contrib folder using the terminal (For example: cd public_html/d8/modules/contrib) and follow the steps : Download DMU using the drush command drush dl drupalmoduleupgrader. For example : xx@xx:~/public_html/d8/modules/contrib$ drush dl drupalmoduleupgrader Project drupalmoduleupgrader (8.x-1.2) downloaded to [success] /home/xx/public_html/d8/modules/contrib/drupalmoduleupgrader. Now get into your Drupal module upgrader folder and install Composer. For example: xx@xx:~/public_html/d8/modules/contrib$ cd drupalmoduleupgrader/ xx@xx:~/public_html/d8/modules/contrib/drupalmoduleupgrader$ composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file - Installing cebe/markdown (dev-master f89dc1d) Cloning f89dc1da1fc6823f0286d6cad736a642efd0f59e - Installing phpdocumentor/reflection-docblock (2.0.4) Loading from cache - Installing grom358/pharborist (dev-master 0db9e51) Cloning 0db9e51299a80e95b06857ed1809f59bbbab1af6 - Installing symfony/filesystem (2.6.x-dev 823c035) Cloning 823c035b1a5c13a4924e324d016eb07e70f94735 - Installing symfony/finder (2.6.x-dev 203a10f) Cloning 203a10f928ae30176deeba33512999233181dd28 - Installing mikey179/vfsstream (v1.5.0) Loading from cache - Installing phpunit/php-token-stream (1.4.8) Loading from cache - Installing symfony/yaml (v2.7.4) Loading from cache - Installing sebastian/version (1.0.6) Loading from cache - Installing sebastian/global-state (1.0.0) Loading from cache - Installing sebastian/recursion-context (1.0.1) Loading from cache - Installing sebastian/exporter (1.2.1) Loading from cache - Installing sebastian/environment (1.3.2) Loading from cache - Installing sebastian/diff (1.3.0) Loading from cache - Installing sebastian/comparator (1.2.0) Loading from cache - Installing phpunit/php-text-template (1.2.1) Loading from cache - Installing doctrine/instantiator (1.0.5) Loading from cache - Installing phpunit/phpunit-mock-objects (2.3.7) Loading from cache - Installing phpunit/php-timer (1.0.7) Loading from cache - Installing phpunit/php-file-iterator (1.4.1) Loading from cache - Installing phpunit/php-code-coverage (2.2.3) Loading from cache - Installing phpspec/prophecy (v1.5.0) Loading from cache - Installing phpunit/phpunit (4.8.9) Loading from cache phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0) phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0) sebastian/global-state suggests installing ext-uopz (*) phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1) phpunit/phpunit suggests installing phpunit/php-invoker (~1.1) Generating autoload files Get back to your contrib folder and clone your Drupal 7 module to it. You can find its cloning commands from its Drupal.org version control page. Here for example: commerce_techprocess is used as Drupal 7 module for migration. xx@xx:~/public_html/d8/modules/contrib/drupalmoduleupgrader$ cd .. xx@xx:~/public_html/d8/modules/contrib$ git clone --branch 7.x-1.x http://git.drupal.org/project/commerce_techprocess.git Cloning into 'commerce_techprocess'... remote: Counting objects: 23, done. remote: Compressing objects: 100% (22/22), done. remote: Total 23 (delta 6), reused 0 (delta 0) Unpacking objects: 100% (23/23), done. Checking connectivity... done. Get back to your site root directory and enable drupalmoduleupgrader. xx@xx:~/public_html/d8$ drush en drupalmoduleupgrader The following extensions will be enabled: drupalmoduleupgrader Do you really want to continue? (y/n): y drupalmoduleupgrader was enabled successfully. [ok] Now start analysing your module using the upgrader, it will list out the fixes and generate an html info file. xx@xx:~/public_html/d8$ drush dmu-analyze commerce_techprocess --path=modules/contrib/commerce_techprocess/ Indexing...done. Generated a report at [success] modules/contrib/commerce_techprocess//upgrade-info.html After all, you can upgrade your module using the command, xx@xx:~/public_html/d8$ drush dmu-upgrade commerce_techprocess --path=modules/contrib/commerce_techprocess/ Indexing...done. It will automatically create some of the Drupal 8 supporting files (for example: .info.yml, .routing.yml etc) and update some of your module codes, and other main functionalities will be commented and provide a @FIXME comment along with it. So that you can easily findout the necessary fixes that the DMU can't do. Now enable your module and fix the issues in Drupal 8 syntax. Also note that your .info or other Drupal 7 supporting files will be there which can be easily removed after fix(if it has no use) and completely upgrading your module codes. Now test your code. Happy Coding! Drupal 8 Drupal 7 Leave a reply Your email address will not be published. Required fields are marked *
/themes/custom/zyxpro_light/images/placeholder.png
17th December 2018 Drupal , Drupal 7
close

on 17th December 2018 / by webmaster
To implement push notification for a project, we first created a new custom plugin to push messages into a custom table. When the cron runs, the messages stored in the queue table will be processed and saved to the custom table. For this, create a new directory "push" in message_notify/plugins/notifier/ and use it just like email or sms. The directory may contain 2 files: push.inc MessageNotifierPush.class.php In push.inc, create a plugin with class and view modes $plugin = array( 'title' => t('Push'), 'description' => t('Send Message as notification.'), 'class' => 'MessageNotifierPush', // A notifier must define its own view modes. // Those view modes are later going to be rendered and sent. 'view_modes' => array( 'message_notify_push_body' => array('label' => t('Notify - Push body')), ), ); The MessageNotifierPush.class.php extends MessageNotifierBase class and can be structured as: class MessageNotifierPush extends MessageNotifierBase { public function deliver(array $output = array()) { $notification_text = strip_tags($output['message_notify_push_body']); $message = $this->message; // Get the message object and the notification text and pass it to the custom function return abc_push($message, $notification_text); } } In our custom function, abc_push function will fetch the details of message in the queue table. function abc_push($message, $notification_text) { $wrapper = entity_metadata_wrapper('message', $message); $field_value = $wrapper->{field_name}->raw(); // Rest of the code here... } These field values are then saved to our database table. We can display these field values wherever needed. Drupal Drupal 7 Leave a reply Your email address will not be published. Required fields are marked *
/themes/custom/zyxpro_light/images/placeholder.png
17th December 2018 Drupal 8
close

on 17th December 2018 / by wellme.m
For one of my project, I have implemented the Redis module in Drupal 8. I have used the following configurations as follows: First I download Redis module for a Drupal 8 environment and stored it in 'modules/contrib' directory and enabled the same. For the working of Redis module we need its libraries, so first you have to download the phpredis php extension library from https://github.com/nicolasff/phpredis. Extract the entire contents of the archive into the 'libraries/' folder. For the working of Redis in local server we have add php extension to our local server. For this follow the steps for seting up Redis Server After that update the settings.php file with the following code: $settings['redis.connection']['interface'] = 'PhpRedis'; // Host ip address. $settings['redis.connection']['host'] = '127.0.0.1'; $settings['cache']['default'] = 'cache.backend.redis'; // Redis port. $settings['redis.connection']['port'] = '6379'; $settings['redis.connection']['base'] = 12; // Password of redis updated in php.ini file. $settings['redis.connection']['password'] = "password"; $settings['cache']['bins']['bootstrap'] = 'cache.backend.chainedfast'; $settings['cache']['bins']['discovery'] = 'cache.backend.chainedfast'; $settings['cache']['bins']['config'] = 'cache.backend.chainedfast'; Create services.yml and add the below code in it. services: # Cache tag checksum backend. Used by redis and most other cache backend # to deal with cache tag invalidations. cache_tags.invalidator.checksum: class: Drupal\redis\Cache\RedisCacheTagsChecksum arguments: ['@redis.factory'] tags: - { name: cache_tags_invalidator } # Replaces the default lock backend with a redis implementation. lock: class: Drupal\Core\Lock\LockBackendInterface factory: ['@redis.lock.factory', get] # Replaces the default persistent lock backend with a redis implementation. lock.persistent: class: Drupal\Core\Lock\LockBackendInterface factory: ['@redis.lock.factory', get] arguments: [true] # Replaces the default flood backend with a redis implementation. flood: class: Drupal\Core\Flood\FloodInterface factory: ['@redis.flood.factory', get] Hope this is useful. Drupal 8 Leave a reply Your email address will not be published. Required fields are marked *
Subscribe to