Planet Drupal

Subscribe to Planet Drupal feed - aggregated feeds in category Planet Drupal
Updated: 2 days 1 hour ago

Phponwebsites: Update multiple fields using #ajax in Drupal 7 form

1 March 2017 - 11:18am
     We know how to replace a field using #ajax in a form. Can we update multiple fields using #ajax in a form? Yes, we can update multiple fields using #ajax in the Drupal 7. We can achieve it using ajax_command_replace() in Drupal 7. For more details about ajax commands on Drupal 7, please visit

Update fields using #ajax in a Drupal form:
    Consider the following example. In this example, I've created a form with fields First, Second & Third name. I tried to update the Second & Third name fields when focus out on the First name field.
/** * Implments hook_form() */function phponwebsites_ajax_form($form, &$form_state) {  $form['firstname'] = array(    '#title' => t('First name'),    '#type' => 'textfield',    '#ajax' => array(      'callback' => '_generate_textfield',      'wrapper' => 'copied-text-field',    )  );
  $form['secondname'] = array(    '#title' => t('Second name'),    '#type' => 'textfield',    '#prefix' => '<div id="copied-secondname">',    '#suffix' => '</div>',  );
  $form['thirdname'] = array(    '#title' => t('Third name'),    '#type' => 'textfield',    '#prefix' => '<div id="copied-thirdname">',    '#suffix' => '</div>',  );
  $form['submit'] = array(    '#type' => 'submit',    '#value' => 'Submit'  );
  return $form;}
function _generate_textfield($form, &$form_state) {  if (!empty($form_state['values']['firstname'])) {    $form['secondname']['#value'] =  $form_state['values']['firstname'];    $form['thirdname']['#value'] =  $form_state['values']['firstname'];  }  $commands = array();  $commands[] = ajax_command_replace('#copied-secondname', drupal_render($form['secondname']));  $commands[] = ajax_command_replace('#copied-thirdname', drupal_render($form['thirdname']));  return array('#type' => 'ajax', '#commands' => $commands);}
When you tried to execute the above codes, it'll populate the same name on the other 2 fields. It looks likes the below image:

Now I hope you know how to populate multiple fields using #ajax in Drupal 7 forms.Related articles:
Remove speical characters from URL alias using pathauto module in Drupal 7
Add new menu item into already created menu in Drupal 7
Add class into menu item in Drupal 7
Create menu tab programmatically in Drupal 7
Add custom fields to search api index in Drupal 7
Clear views cache when insert, update and delete a node in Drupal 7
Create a page without header and footer in Drupal 7
Login using both email and username in Drupal 7
Disable future dates in date pop-up calendar Drupal 7
Categories: Drupal

Sooper Drupal Themes: It's The Details That Make A Good Product Great: Glazed Theme 2.6.3 And Builder 1.1.2 Updates!

1 March 2017 - 8:53am

It's the details that make the difference between a good product and a great product. The past 6 weeks were spent on refining the design patterns that constitute the Glazed branding and products. The result is a product that feels tight and inspires confidence. Just 2 years young, Glazed Builder is the new kid on the block but the progress since 1.0 has never slowed down. With the seeminlgy everlasting lack of quality Drupal themes for Drupal 7 and especially 8 I think that with Glazed Theme and Glazed Builder we have the platform that is needed to really fuse Drupal's powerful backend with beautiful designs in a maintainable, responsible way. In the future we'll be working hard on realizing this ambition, and publishing new designs for different niches.

Try Glazed Builder Now

The Admin demo is free, no registration required!

Better Controls Positioning

Glazed Builder is different from consumer tools like Wix and Squarespace because it doesn't put limitations on where you place elements. Our grid system is based on bootstrap and our tools allow you to use Bootstrap elements like you would if you were custom coding. You're coding without having to write or see the code. The consequence was that sometimes nested rows, tabs, accordeons etc. had so many controls that they could overlap. 

This problem is was not easily solved, that is probably why you find very few drag and drop builders without some restrictions to where you place your elements. With this week's release the problem is no longer a problem. We're introducing a new algorithm for controls positioning. Thanks to advancements in browser APIs it's now feasible to do hit detection efficiently. This means we create space for icons when necessary, but we leave the layout intact where we can. This doesn't just solve the overlapping controls problem but also creates a much closer WYSIWYG experience.  

Performance Improvements for Theme and Builder

With Mobile performance more important than ever it's our responsibility to be vigilant about performance and take action when we see opportunity for improvement. One such improvement is our menu system. Our unique mobile menu provides an unparalleled navigation experience, and uses a bit of JavaScript to manage this. This caused a menu flickering on long page because the menu initiation happened close to the bottom of the page. This code was moved to the beginning of the page to speed up the menu render.

Other improvements have been made by replacing jQuery with browser native APIs, partly using the new knowledge that was gained from creating our unique controls positioning algorithm. 

Material Style Box Shadows

Material Design box shadows are now available in the style tab using a simple slider. The slider represents the "surface level" metaphor used in Material Design's documentation and it renders elegant and simple shadows that are taken directly from Google's recommendations about drop shadows in Material Design.. 

Ready for Drupal 8

We're currently developing the Drupal 8 version of the Glazed installation profile and we are starting to upgrade our theme and modules.​ We previsouly aimed to release our Drupal 8 beta alongside the Drupal 8.3 release, but now that the D8media initiative has postponed their work to be released in Drupal 8.4 we are relaxing this deadline.

We're taking our time to make the right decisions about our installation profile, our theme, our drag and drop builder, and all the thousands of lines of code that make up our themes and demo websites. Expect to see Drupal 8 beta products somewhere after the 8.3 release of Drupal core and before the 8.4 release.


For more details about this week's updates:

        Try Glazed Builder Now

        The Admin demo is free, no registration required!

        Categories: Drupal

        Drupal blog: Drupal 8.3.0-rc1 is available for testing

        1 March 2017 - 8:50am

        The first release candidate for the upcoming Drupal 8.3.0 release is now available for testing. Drupal 8.3.0 is expected to be released April 5.

        Download Drupal-8.3.0-rc1

        8.3.x includes new experimental modules for workflows, layout discovery and field layouts; raises stability of the BigPipe module to stable and the Migrate module to beta; and includes several REST, content moderation, authoring experience, performance, and testing improvements among other things. You can read a detailed list of improvements in the announcements of alpha1 and beta1.

        What does this mean to me? For Drupal 8 site owners

        The final bugfix release of 8.2.x has been released. A final security release window for 8.2.x is scheduled for March 15, but 8.2.x will receive no further releases following 8.3.0, and sites should prepare to update from 8.2.x to 8.3.x in order to continue getting bug and security fixes. Use update.php to update your 8.2.x sites to the 8.3.x series, just as you would to update from (e.g.) 8.2.4 to 8.2.5. You can use this release candidate to test the update. (Always back up your data before updating sites, and do not test updates in production.)

        For module and theme authors

        Drupal 8.3.x is backwards-compatible with 8.2.x. However, it does include internal API changes and API changes to experimental modules, so some minor updates may be required. Review the change records for 8.3.x, and test modules and themes with the release candidate now.

        For translators

        Some text changes were made since Drupal 8.2.0. automatically offers these new and modified strings for translation. Strings are frozen with the release candidate, so translators can now update translations.

        For core developers

        All outstanding issues filed against 8.2.x were automatically migrated to 8.3.x. Future bug reports should be targeted against the 8.3.x branch. 8.4.x will remain open for new development during the 8.3.x release candidate phase. For more information, see the release candidate phase announcement.

        Your bug reports help make Drupal better!

        Release candidates are a chance to identify bugs for the upcoming release, so help us by searching the issue queue for any bugs you find, and filing a new issue if your bug has not been reported yet.

        Categories: Drupal It's NOT Amazon's fault the internet broke yesterday - it's OURS!

        1 March 2017 - 8:26am

        You probably noticed that many sites and apps were having serious problems yesterday due to an Amazon AWS outage.

        Some sites/apps were completely down, and others had partial or reduced functionality. In the Drupal world, Pantheon was affected: sites didn't go down (huzzah for Pantheon!), but everything was in read-only mode for several hours, so users couldn't upload files to their sites and many dashboard functions didn't work.

        Already, many are talking about how this outage is proof that the public cloud is a bad idea. Or, that Amazon messed up big time and maybe we should look at other cloud providers.

        However, I'm going to argue that it wasn't Amazon's fault that this outage took down so many sites and apps.

        And by extension, this isn't proof that the cloud is a bad idea, or that we should look to providers other than Amazon. The cloud is great, and so is Amazon AWS.

        I'm going to argue that it's OUR fault -- the web developers who make all these great apps and sites -- that this outage broke the internet.

        Please read more to find out why!

        Categories: Drupal

        Evolving Web: Drupal Theming and Site Building: 6 Best Practices

        1 March 2017 - 7:39am

        There are many ways of building sites and themes - be it Drupal, Wordpress, Magento or any Content Management System. In my particular case, after nine years of building Drupal themes, reading how other themers do it, and learning from my mistakes, I came up with a few tips I would like to share with everyone.

        Choose a good base theme

        As I mentioned in my previous post, Planning Your Drupal 8 Theme: Choosing a Base Theme, there are lots of factors that will influence your final decision, but you'll eventually start feeling more comfortable with one, and that will be the one you'll be using for most projects.

        Study the options

        My first and most important tip: choose a base theme wisely. Try to see what other people use, how they do it and what experiences they had with it.

        Apart from the quality and popularity of a theme, the following questions will always help you make your choice:

        • How many people use it? Some themes like Bootstrap have more than 130,000 Drupal 7 & 8 reported installs. This means more people testing it, more live sites and more interest in pushing it forward.
        • Is its use increasing? A theme that more and more people use all the time is a good indicator of the project health. The "Installation ratio" indicates that it is growing up and gaining popularity across the community.
        • Is there someone regularly behind it? Just feel free to check the issue queue for the latest issues and commits.
        • How do I start? What if I have questions? Most themes include their own detailed docs. The issue queue is also a nice source for docs which help one learn how to work with the relevant theme.
        • How safe is it? Themes and modules are as safe as any Open Source software. Check for the well-maintained ones, and make sure their stable releases are covered by the Security Advisory Policy - the green shield close to the download.

        As I said before, feel free to explore all the available options at and ask yourself each one of those questions before making a final decision.

        ...and never modify the base theme

        Base themes are meant to be used as base themes, not as starter themes. If you edit theme files directly, the changes may be lost when you run updates in the future. Be sure to read the Creating a Drupal sub-theme docs in to properly use these on your projects.

        Views should always be your first approach

        There are many ways to build pages in Drupal, either using Views, Panels, Blocks, "Full HTML" on the node body and so on. But there is that feeling you get when you make it work using a View:

        "Wow... this is how it should be."

        When you use Views, you feel you are doing it right. You feel it is reusable, portable and very flexible. Any Drupal site should be, at least, 90% Views on the Front-end side.

        When creating a new page, I suggest preferring the following methods, in order: if you can't build your page with one method, only then fall back to the item below. The lower you go down the list, the less reusable and flexible your solution will be.

        Can I achieve it with...?

        • Views
        • Panels
        • Blocks
        • Paragraphs
        • Display Modes
        • Full HTML
        • Template Files
        In most cases, this has worked for me over the years. Just feel free to evaluate it against solutions you have built before. I would love to hear about your experience on comments below. Template files are the last option

        Based on the list above, editing the template files (.tpl.php on D6/7 and .twig on D8) should always be the last option of your theming strategy

        Template files should only be considered when:

        • Adding & editing regions.
        • Making global layout changes.
        • Customizing your layout structure.

        Remember that while overriding template files of a base theme, we are risking smooth support for future updates of it, making our update process harder when newer versions of the base theme come out.

        Use SASS for your styles

        With SASS, the maintainability and reusability of CSS styles go to an entirely new level. It is impressive how much time is saved and how flexible and easy to maintain SASS files are, compared to traditional CSS management.

        SASS helps you create styling that is more consistent across different site components, which makes themes more extensible. In a previous blog post, I detailed its benefits along with a comprehensive set of steps of how to add it to your theme while moving your existing stylesheets to SASS.

        Use Paragraphs for your landing pages

        Paragraphs is a new module every site builder should use for creating landing pages. It is definitely a new approach for managing different sections of content inside of the body field. You feel like you're managing movable pieces of HTML code, as it is a flexible way to add, sort & customize sections on a particular section of a page.

        If you are new to Paragraphs, my colleague Suzanne Dergacheva has an interesting post that details How to Create Landing Pages with Drupal 8 and Paragraphs.

        Where to go now

        Well, it is definitely up to you :) but I suggest everyone to take a look at the following posts as these will help you improve your theming workflow and overall knowledge of Drupal 8:

        And feel free to give some feedback below. Your comments will help me and everyone else improve our theming skills. + more awesome articles by Evolving Web
        Categories: Drupal

        Evolving Web: Drupal Theming and Site Building: 6 Best Practices

        1 March 2017 - 7:39am

        There are many ways of building sites and themes - be it Drupal, Wordpress, Magento or any Content Management System. In my particular case, after nine years of building Drupal themes, reading how other themers do it, and learning from my mistakes, I came up with a few tips I would like to share with everyone.

        read more
        Categories: Drupal

        Acquia Developer Center Blog: 249: Changing lives, changing the world - voices from the Dublin Driesnote

        1 March 2017 - 7:30am

        DrupalCon Dublin keynote community voices - In Acquia podcast 248, Acquia Office of the CTO Multimedia Designer, Alena "ASH" Heath and I talked about helping capture stories of contribution and change from the Drupal community. In this quick follow-up, here are the soundbites that were featured in Dries Buytaert's "Driesnote" address at DrupalCon Dublin, 2016.

        A warm round of thanks to Vijaya Chandran Mani, Zsófi Major, Drew Gorton, Franck Seferiba Salif Soulama, Suchi Garg, Ronan Dowling, Jack Holding, Sheena Morris, and Crispin Read. Thanks for all your help, contributions, and being part of the Drupal community!

        Skill Level: BeginnerIntermediateAdvanced
        Categories: Drupal

        Acquia Developer Center Blog: 248: What's in a Driesnote? ASH 'n jam talk community stories.

        1 March 2017 - 7:30am

        Acquia Office of the CTO Multimedia Designer, Alena "ASH" Heath and I collaborated in 2016, collecting stories about contribution and changing lives from members of the Drupal community. Soundbites from some of those conversations were included in Dries Buytaert's "Driesnote" keynote address at DrupalCon Dublin. In this podcast, we talk about ASH's history in Drupal, this project and what we learned along the way!

        Skill Level: BeginnerIntermediateAdvanced
        Categories: Drupal

        Chromatic: Code Reviews are Worth Their Weight in Gold

        1 March 2017 - 6:40am

        Code reviews are not just a quality assurance (QA) process with a different name. They offer a wide variety of benefits to everyone involved, that go well beyond the inherent advantages of a QA process benefits.

        Categories: Drupal

        Blair Wadman: Transitioning from Drupal 7 to Drupal 8: programatically creating routes and menu items

        1 March 2017 - 6:29am

        Routes and menu items are a critical part of the Drupal system. Without them, users would not be able to access the content of a website or any other page. Conceptually Drupal 7 and 8 are the same: map a URL to a function that is responsible for getting and returning the content.

        Categories: Drupal

        InternetDevels: The Group module to manage your site access and permissions

        1 March 2017 - 6:24am

        We continue to bring you closer to Drupal 8 modules, because they worth your
        attention. Previously we were talking about such modules as Rules,
        BigPipe, Fast 404 and others.

        Read more
        Categories: Drupal Blog: AGILEDROP: Drupal Logos as Fruits and Vegetables

        1 March 2017 - 1:30am
        Our journey with Druplicons has just started. Last time, we presented you Drupal Logos in Human and Superhuman Forms. Now, it's time to see, how Druplicon can be designed in the shapes of Fruits and Vegetables. First, we'll start with fruits. Druplicon can be an orange (Drupal Camp Atlanta 2016),     which is very similar to Druplicon from the same camp in 2009     Druplicon can be designed as an apple (Drupal Camp NYC 2014)     DruplIcon as a Lemon   Druplicon as a cherry (Drupal Camp Twin Cities 2011)     On the other hand, Vegetable is not neglected. Druplicon can be as an ear… READ MORE
        Categories: Drupal

        ADCI Solutions: Review of search tools for Drupal

        1 March 2017 - 1:12am

        A quick search and retrieval of relevant results affect the overall quality of customer service. How besides the standard Drupal functionality could the search be implemented? First of all, a Drupal developer should consider a project’s size. A built-in Drupal search or a combination of Search API and a database search would be enough for small websites, but the same won’t work for high load websites. We described the most useful and easy-to-integrate with Drupal search engines. Below is a review of strengths and weaknesses of different systems depending on project requirements. Choose wisely! Read the full article here.




        Categories: Drupal

        Droptica: Droptica: Flexible and easy content creation in Drupal - the Paragraphs module 

        1 March 2017 - 12:56am
        Content creation using the Paragraphs module is a completely different approach compared to the "standard" content creation in Drupal. In short: we prepare the components (paragraph type) and then, during the creation of an entry, we select any of the available components.  The components can be simple elements containing text, contents with columns or such complex elements as sliders, videos or photo galleries. There are practically no constraints; we can define the available components by ourselves, which will then be used by people dealing with content management.  We can prepare our own templates for the components (tpl.php files). Properly prepared templates and styles for them will ensure the same display of components, regardless of their place of use and the device (responsiveness).
        Categories: Drupal

        ADCI Solutions: REST Web Services in Drupal 8: quick start guide

        1 March 2017 - 12:30am

        Restful API (also known as web services) gives a wide range of new abilities to developers. Being closely related to Headless Drupal, Restful API lets two computers communicate with each other without any human intervention. It’s called ‘Internet of Things’ (IoT): anything connected to the Internet can be a computer - even your coffee machine. That’s possible when devices use the same API. Amazing, isn't it? Let's look under the hood of the web services in Drupal 8, how they work and how they can be used. The full article is here.

        Categories: Drupal

        Third & Grove: Williams-Sonoma To The Trade Drupal Case Study

        1 March 2017 - 12:00am
        Williams-Sonoma To The Trade Drupal Case Study antonella Wed, 03/01/2017 - 03:00
        Categories: Drupal