Planet Drupal

Subscribe to Planet Drupal feed
Drupal.org - aggregated feeds in category Planet Drupal
Updated: 17 hours 10 min ago

Acquia Developer Center Blog: Introducing Bolt, a Development Tool for Generating New Drupal 8 Projects

25 May 2016 - 9:09am

It's my pleasure to introduce Acquia Bolt, a development tool for generating new Drupal projects using a template derived from our Professional Services' best practices.

We began building and using Bolt internally over the past year. Our goal was to codify a set of tools and conventions that would allow us to:

Tags: acquia drupal planet
Categories: Drupal

Mediacurrent: Dropcast: Episode 20 - Kind of a big deal

25 May 2016 - 8:53am

This episode we hit a land mark of twenty episodes, so instead of picking on Mario the entire time, we talk about our favorite moments at Drupalcon in New Orleans. Of course this is funny since half of us didn't actually attend the 'Con. Other episode titles considered: "Bob and Mario live vicariously through Mark and Ryan"

Categories: Drupal

Drupal Bits at Web-Dev: Drupal file_scan_directory option nomask

25 May 2016 - 7:44am

Other than a quick sample of blocking a specific file extension using the 'nomask' option, the documenttation for Drupal's file_scan_directory() does not help much with how to bock content from certain directories.  The documentation says

The  Perform a regular expression match">preg_match() regular expression of the files to ignore.'

So it leaves you to believe that any regex should work.   So setting

$options['nomask'] = "#(/deleted/)#"

should block any directory named 'deleted'.  The problem is, it doesn't work that way.   In file_scan_directory() the regex is not run against the full path of the file, it is only run against the directory or filename recursively.  It is not evaluating  'directory1/subsection/deleted/index.html' , where the regex above would definitely come back with a hit and reject the item.  It is first evaluating, 'directory', then 'subsection', then 'deleted'...   It does not get a hit on deleted because it is missing the slashes on each side.

One possibilty would be to remove the slashes from the regex like this:

$options['nomask'] = "#(deleted)#";

But without the slashes, it would not only reject the directory 'deleted', it would reject the directory 'not-deleted'  and the file 'faq-why-my-account-was-deleted.htm' which might have undesired consequences.

The trick to get it to reject only 'deleted' as a directory and its contents is to restrict the regex to only the start and end of the string being evaluated. like this

$options['nomask'] = "#^(deleted)$#";

and if you wanted to block 'deleted' and another directory like '_vti_cnf' it would look like this:

$options['nomask'] = "#^(deleted|_vti_cnf)$#";

 

Categories: Drupal

Mediacurrent: Security Talks at DrupalCon New Orleans 2016

25 May 2016 - 7:11am

While I have had the privilege of attending a number of DrupalCons and camps over the years, I cannot remember one with as many sessions and BOFs (birds of a feather) on the topic of security. In addition to the security talk on the program schedule, I had a great time chatting with individuals in the hallways and a few security focused companies in the exhibit hall. 

Categories: Drupal

Mediacurrent: 6 Questions Every Project Manager Should Ask

25 May 2016 - 6:27am

Your company’s business development team just announced a new Drupal project has been given the green light, and you will be the project manager. What do you need to do to help your development and strategy teams succeed in giving the client the best possible experience and product? You need to ask the right questions.

3 questions to ask regardless of the CMS in play

The project manager of any technical project, leveraging Drupal or some other CMS, should first and foremost ask:

1. Where is the Statement of Work (SOW) and how do I access it?

Categories: Drupal

Liip: Drupal: Dynamic IMCE Profiles

25 May 2016 - 5:15am

Today I will describe a way to handle multiple teams with their own private file folders using the IMCE module.

Let’s pretend that we have to develop a website called awesome-website.com which consists of three (or more) different teams. The team structure could look as followed:

Every team should only be allowed to edit their own pages but no page from any other team. Therefore it would also make sense to separate the team’s file folders so that the files can be stored separately to secure its privacy.
Of course, we could simply add three IMCE profiles and define their folder access rights individually there. But what about when working with 10 teams? Or 50? Or even more? Then we definitely would prefer a more flexible solution.
Thankfully, IMCE ships with the ability to define user folders by PHP execution, how awesome! But in order to achieve this, we’ll have to set up teams as taxonomy terms first and reference them from our user entities.

Setting up the “Teams” taxonomy vocabulary

First things first: Let’s create a new taxonomy vocabulary called “Teams”. For every team that we will have on our website, we have to create a new taxonomy term in this vocabulary.
Before adding any teams as taxonomy terms though, we’ll have to add a new field called “FTP Folder” to the taxonomy vocabulary.
This field will specify the name of every team’s root folder. So, naturally it shouldn’t contain any spaces or other wicked special characters and it should be URL readable.
In order not to face any unusual results later, it is recommended to configure this field as required.

Afterwards, we can add our three terms, “Team Alpha”, “Team Beta” and “Team Gamma”.
As value for their FTP Folders, we use “team-alpha”, “team-beta” and so on.

That’s it for the taxonomy part! Now let’s link this information to the team’s users.

Adding a taxonomy term reference field to the user entity

In my case, I didn’t have multiple roles for the teams. I only had one, called “Team member”. Because every team has exactly the same rights as the others, maintaining only one role suited me best.
For really special cases, I could always just create a new role with the special permissions.

So, how do we link users to their teams the easiest? Exactly, by just adding a taxonomy term reference field to the user entity!
Let’s call this field “Team” and reference our previously created taxonomy vocabulary “Teams” with it.

Now, when adding a new user, we can select it’s team belonging and IMCE will be able to grab the needed information from there.
Yes, IMCE will be able to do that but it’s not doing it yet.
Getting the teams ftp folder for the current user is still something we have to code, so let’s proceed to the next step.

Writing a custom function to provide the accessible directories for an user

Now we need to provide IMCE the information that we’ve set up before.
We’ve created users belonging to teams, which hold the FTP root folder name for the teams.
What’s left to do, is to write a function (ideally in a custom module, in my example the module is called “awesome_teams”), that combines all information and returns it to IMCE.
Following function would do that for us:

function awesome_teams_imce($user) { $user_folders = array('cms/teams/all'); $user_wrapper = entity_metadata_wrapper('user', $user); $user_teams = $user_wrapper->field_team->value(); foreach ($user_teams as $user_team) { $user_team_wrapper = entity_metadata_wrapper('taxonomy_term', $user_team); array_push($user_folders, 'cms/teams/' . $user_team_wrapper->field_ftp_folder->value()); } return $user_folders; }

The function expects an user object as argument and will return an array of strings containing all the folder names an user is allowed to access.
Our folder structure would look like this:

  • sites/default/files/cms
  • sites/default/files/cms/teams
  • sites/default/files/cms/teams/all
  • sites/default/files/cms/teams/team-alpha
  • sites/default/files/cms/teams/team-beta
  • sites/default/files/cms/teams/team-gamma

Note: The folder “cms/teams/all” is a special folder and every user is allowed to access it.
It will be used to save files which are used globally over multiple or even all teams.

What our code does, is actually looping over all assigned teams for the given user (yes, an user can be in multiple teams!), and adding the teams ftp folder names to the array of accessible folders.

There is no “hook_imce” hook, the “_imce” in the function name does nothing till now. You can also name your function differently. The link from IMCE to our function is something we have to set up in an IMCE profile.
Let’s proceed to the last step then, shall we?

Creating the IMCE profile “Team member”

Now, as the last step, let’s create an IMCE profile called “Team member”. You’re free to define any settings as you like, there’s only one thing that will be special about this profile: The accessible directories path.

Instead of writing something constant as “cms/teams/team-alpha”, we’ll write “php: return awesome_teams_imce($user);” here.
So, the setting should look like this:

Now save the profile and you are done!

As soon as one team member now accesses the IMCE page (either via /imce or by the configured file/image fields), he will only see his team’s directories and the special directory “all” which is meant for exchange.

This wasn’t that difficult, was it?

I hope I was able to give you an insight on how to solve more complicated file permission issues with IMCE.
Don’t forget to give feedback, ask questions and follow our blog if you want to read more about our Drupal experiences at Liip!

Categories: Drupal

LevelTen Interactive: DrupalCon[densed] 2016: The Best Business Sessions

24 May 2016 - 10:00pm

My role as a principal at LevelTen means that I spend a lot of time overseeing Accounting, Operations, and Marketing. So for my visit to DrupalCon 2016, I wanted to spend as much time as I could talking with other C-level people to see what struggles we have in common and what solutions we've come up with.

Throughout the sessions, summits, and socializing, there were a few key themes that kept coming up over and over from people who run Drupal shops. With that in mind, this post is less of a DrupalCon 2016 takeaway than a preliminary analysis of the economics of Drupal as it...Read more

Categories: Drupal

Mediacurrent: A quicker way to apply a Drupal / contrib patch

24 May 2016 - 2:57pm

The normal Drupal instructions for applying patches are well used and reliable. However, I find them to be a little verbose, so I came up with a slightly quicker workflow.

TL;DR

The short explanation of what I do is to copy the patch's URL and run this command:

curl [patch URL] | patch -p1

Which would then become something like this:

Categories: Drupal

Metal Toad: What I Learned Today: Views Plugin Debugging

24 May 2016 - 12:52pm
What I Learned Today: Views Plugin Debugging May 24th, 2016 Jonathan Jordan

As I've said before in my custom views filter handlers tutorial, views is amazing. Today I was writing a custom style plugin. I got the plugin to show up in the list of available formats, but whenever I saved the form, it wouldn't stick.

My Typical Method of Debugging in Drupal

Typically I would throw dpm's to debug, so I started walking through the callstack trying to find where things were going wrong. Then I ran into a line in views that called vpr(). It looked like a print_r debug statement, so I knew this was either being logged or there was a setting somewhere.

A Better Way to Debug Views Plugins

Sure enough it is part of the "Enable views performance statistics" setting to have these messages logged with watchdog. To turn it on go to /admin/structure/views/settings/advanced. Even better, when you turn Devel on, you can have them dpm'ed instead. Now I get exactly the information I need to figure out what I was doing wrong, without having to throw my own dpm's in views or ctools.

Other Views Settings for Debugging

Also, if you are just looking to debug your views query the "Show the SQL query" and "Show performance statistics" options on /admin/structure/views/settings are invaluable.

This post is part of my challenge to never stop learning.
Categories: Drupal

Chapter Three: How to Secure Drupal HTTP Headers

24 May 2016 - 11:29am

In this blog post I will briefly overview some of the very useful HTTP response header parameters that will help to secure any website. In short - HTTP Response headers are name-value pairs of strings sent back from a server with the content you requested. More information can be found on the internet.

I will cover some of the most important security-related HTTP parameters. The original blog post was written by Scott Helme who is the creator of SecurityHeaders.io. This is a brief overview of his blog post to introduce this technique to our readers.

Categories: Drupal

Janez Urevc: Drupal's number 1 is from Switzerland

24 May 2016 - 6:49am
Drupal's number 1 is from Switzerland slashrsm Tue, 24.05.2016 - 15:49

Swiss has traditionally been dedicated to the best quality and innovation. Some of the best things in life come from Switzerland. Did anyone mention chocolate?

Photo by Janine, released under CC BY 2.0

Drupal and free software are no exception. Many companies and individuals are dedicated to them on a daily basis. That said, it is no surprise that Drupal's number one comes from Switzerland.

Jerome from MD Systems explains how we achieved that, which are the main advantages of Drupal and why everyone should use it. Very interesting read!

Categories: Drupal

Janez Urevc: Drupal community, please meet Vijay

24 May 2016 - 1:40am
Drupal community, please meet Vijay slashrsm Tue, 24.05.2016 - 10:40

Google summer of code 2016 started with a full swing this week. Vijay is one of the students participating in it. He is working on the Media module for Drupal 8.

He wrote an introduction blog post. I'd like to invite you to read it, say hi and follow his work as it progresses through the summer.

Welcome in the Drupal community Vijay!

Categories: Drupal

LevelTen Interactive: DrupalCon[densed] 2016: The Best Developer Sessions (Part I)

23 May 2016 - 10:00pm

DrupalCon New Orleans was the third DrupalCon I’ve attended, and it never ceases to amaze me how much Drupal has changed over the years, and how much time and effort the community puts in -- not just into core and contrib, but also into building out third party tools, scripts, and methods that will benefit other agencies and freelancers. It really is a privilege to be a part of a community that is so incredibly committed to the values of open source and always willing to share their experience along the way.

Aside from the ...Read more

Categories: Drupal

LevelTen Interactive: DrupalCon[densed] 2016: The Best Developer Sessions (Part II)

23 May 2016 - 10:00pm

As a beginning developer who spent the majority of the last three months learning front-end javascript frameworks and the MEAN stack, I was anxious to get re-acquainted with Drupal, all of its ‘isms, and the storied community behind it. But besides tired feet, a hangover, and a backpack stuffed with free swag, what would I take away from it all?

Looking back, it’s tough to capture all the remarkable insights from such interrelated sessions and do them justice in a single blog post, but I did come across several ideas from the con that stuck with me in one way or another. So...Read more

Categories: Drupal

LevelTen Interactive: Drupal Con[densed] 2016: The Best Developer Sessions (Part II)

23 May 2016 - 10:00pm

As a beginning developer who spent the majority of the last three months learning front-end javascript frameworks and the MEAN stack, I was anxious to get re-acquainted with Drupal, all of its ‘isms, and the storied community behind it. But besides tired feet, a hangover, and a backpack stuffed with free swag, what would I take away from it all?

Looking back, it’s tough to capture all the remarkable insights from such interrelated sessions and do them justice in a single blog post, but I did come across several ideas from the con that stuck with me in one way or another. So...Read more

Categories: Drupal

LevelTen Interactive: Drupal Con[densed] 2016: The Best Developer Sessions (Part I)

23 May 2016 - 10:00pm

DrupalCon New Orleans was the third DrupalCon I’ve attended, and it never ceases to amaze me how much Drupal has changed over the years, and how much time and effort the community puts in -- not just into core and contrib, but also into building out third party tools, scripts, and methods that will benefit other agencies and freelancers. It really is a privilege to be a part of a community that is so incredibly committed to the values of open source and always willing to share their experience along the way.

Aside from the ...Read more

Categories: Drupal

Drupal Association News: Ready to Serve

23 May 2016 - 3:28pm

After five and a half years of serving the Drupal community as a Drupal Association staff member, I’m honored (and thrilled!) to step into the Executive Director role. This community is magical. Your generosity, kindness, and drive to create something meaningful together inspire me every day. Drupal 8 is destined for success, because each drop of code captures this ethos.

You’ve given me so many memorable moments. I remember that feeling of pride—that sense of “I’m one of you now!”—when my sprint mentor helped me contribute to D8. (The contributor sticker on my laptop is a daily reminder of how welcoming you all are.) Then, there was that time at DrupalCon Portland when people joined forces to build a site to help those impacted by a tornado in Oklahoma, USA. And I’ll never forget the first time a company joined our Drupal Supporter Program and then thanked us for creating this way to give back to the Project.

Those who work in other open source projects often point out how unique and special our community is because of its culture. I agree. This community is a bright spot in our complex world, and its health and longevity are worth protecting.

The Association does this through our mission to unite each of you—a global open source community—to BUILD and PROMOTE Drupal. With Drupal 8 out, my job will be to align the Association's resources where they are now needed most. 

Our Mission: To Help You Build and Promote Drupal

Over the last few years, the Drupal Association has partnered with the community to help you build Drupal 8. We invested in an engineering team who helped contribute semantic versioning, DrupalCI, and improved issue queue functionality. We also created the issue credit system to reward and motivate members to contribute to the Project. Plus, we raised funds through Drupal 8 Accelerate to pay for sprints that accelerated the software release. Additionally, DrupalCons have brought thousands of you together to grow your Drupal skills and learn from mentors. And, Con sprints are an opportunity to put that growth to work right away with hundreds of other people.

When Drupal 8 was released, The Drupal Association partnered with the community to promote the software on Drupal.org with rich, educational content, telling the world to “Build something amazing, for anyone.” And, we worked with the community to celebrate this great achievement by coordinating a global party. On release day, there were more than 200 release parties around the world.

We see so many wonderful ways we can help the community build and promote the software, yet our dreams cost more than our funding allows right now. So like any organization with a limited budget, we make choices based on priorities. Leading up to the D8 release, our priority was to help the community release the software. Now that D8 is out in the world, it makes sense to put more effort into promoting the software and do that in a way that only the Drupal Association can uniquely do. And, we need to promote the software in a way that generates more income for the Project so we can sustainably fund all the initiatives that help the community as you build and promote the software.

Grow Adoption. Generate Income

Drupal 8 is a platform that helps end users (customers) create amazing solutions that unleash digital business opportunities and solve business pain points. It’s ideal for complex web solutions as well as mobile, SaaS, and newer tech trends like the Internet of Things (IoT). However, the software alone is often not a complete solution. It must work in concert with third party software and hosting services. These solutions require an architecture strategy, integrations, and implementation—all of which is provided by our large ecosystem of service providers: Drupal shops, system integrators, and digital agencies.

When a CIO or CMO is deciding on Drupal as their platform, these software companies, hosting companies, and service providers want to be included in that decision making process. And, they are willing to pay for the ability to be considered part of a Drupal solution.

As a way to grow Drupal adoption and generate income, the Drupal Association can promote solutions, like Drupal for Higher Education or DevOps for Drupal, through its two main channels: Drupal.org and DrupalCon. For each solution, we’ll invite software companies, hosting companies, and service providers to participate in promotional campaigns and to pay for the ability to engage with the decision makers in our channels.

This is work we’ve already started, and it's working well. On Drupal.org, we have an adoption journey for visitors where they learn about Drupal. We invited other companies to provide educational content and services to improve that journey, so that visitors can see Drupal’s strength when it works in tandem with other technology. For example, from the homepage, people are invited to Download Drupal or Try Drupal, which is a selection of Drupal cloud offerings that let the evaluator get an immediate feel for Drupal. With this approach, we add value for visitors, and we lower barriers to adoption for Drupal. Plus, the Try Drupal partners generate leads and pay the Association for the opportunity.

We’re doing this work through DrupalCon too. We offer one-day summits that focus on specific verticals, such as Higher Ed, Media & Publishing, and Government. Current and prospective Drupal customers use the day to talk about how to use Drupal in new and better ways within their business. These talks help strengthen and deepen customer commitment to Drupal and help new customers decide the best way to use Drupal. As part of this event, we invite sponsors to participate. They are third party software companies and service providers who serve these verticals. We invite them to provide educational content, like case studies, and give them meaningful engagement with the audience. They in turn generate leads for future business and pay us for this business opportunity.

It’s important to point out that this opportunity is for those who want to pay. And that includes Drupal shops, who have always been an important part of our community. But I believe this approach still helps those of you not able to pay. Through promotional campaigns, we can attract more potential customers to the channels you are already engaged in: Drupal.org and DrupalCon. For online campaigns, we can point visitors to the marketplace to find all service providers. At DrupalCon, there are lots of opportunities to network and set meetings with a potential customer. Plus, we will look to share promotional content with businesses so they can use them in their local markets.

Bringing our multi-sided market together to help us promote Drupal and generate income works. It’s a tested approach that we can enhance, ultimately allowing us to realize the full vision of funding more work that helps the community build and promote the software.

Why This Matters

This is personal for me. I want Drupal to be adopted across all sectors and in all kinds of ways, so each of you are rewarded with the opportunity to pursue your Drupal dream and get paid doing it. You all give something special to the Drupal Project, from volunteer coding time to giving hugs and high fives when celebrating or supporting each other. I am constantly moved by these acts of generosity and kindness. My life is better because of knowing you and that fuels me to want to give back in the way that I can. The more we can grow Drupal adoption across sectors, the more doors open up to you to pursue your Drupal dream, from serving citizens through government solutions to working on new technology trends through Internet of Things solutions, and anything in between.

Where do we go from here?

I'm so thankful for Holly Ross's leadership. She showed an amazing ability to build community relationships and operationalize the organization, all while sharing her contagious laugh. The Association is in a better place because of her involvement. By investing in and empowering staff, and by leading by living our values, she created a team that’s passionate about serving our mission. I’m so fortunate to work every day with such incredibly talented, smart, kind, and passionate people. I will fiercely protect this culture we created, because it’s our secret sauce. Together, we’ll build off of the great foundation that Holly created.

I’m working with the board and staff to build towards our vision. We are looking at how to maintain and support the services you need to build the software while creating opportunities to promote solutions through Drupal.org and DrupalCon. We are in thinking and listening mode as we figure out the best way to execute this.

I invite you to share your thoughts on this vision. We are all in this together and we will be able to achieve this goal to fund more work on both sides of the Build/Promote equation if we have a shared vision and work together towards it. So please let me know your thoughts. What are the opportunities you see? What are the areas of concern we should consider?

Categories: Drupal

Matt Glaman: Run \Drupal\Tests\BrowserTestBase with SQLite

23 May 2016 - 3:22pm

As part of the push to deprecate SimpleTest and use PHPUnit as the test runner in Drupal 8, there is the \Drupal\Tests\BrowserTestBase class. The BrowserTestBase provides a Mink runner that tests web pages in Drupal. Unlike kernel tests, which require a database and can be run via PHPUnit as well, browser tests use your default database connection. I prefer to run my tests with SQLite as I do not need to have my Docker containers running.

The simplest solution I have found, thus far, is to check the HTTP_USER_AGRENT

if ($_SERVER['HTTP_USER_AGENT'] == 'Drupal command line') { $databases['default']['default'] = array( 'driver' => 'sqlite', 'database' => '/tmp/test.sqlite', 'namespace' => 'Drupal\\Core\\Database\\Driver\\sqlite', ); }

With this, and running php -S localhost:8080 I'm able to write my Drupal Commerce browser tests without having my normal Docker containers running.

Categories: Drupal

Cocomore: 5 recommendations before starting your first Drupal 8 project

23 May 2016 - 3:00pm

Start developing with Drupal 8 with some tricks and thoughts before starting your first real Drupal 8 project.

Categories: Drupal

Chromatic: Javascript Theme Functions in Drupal 7

23 May 2016 - 9:26am

Like it or not, sometimes you have to output HTML in javascript.

Recently, I ran across a line of code something like this while reviewing a pull-request for a client:

var inputMarkup = '<span><label data-val="' + inputText + '" for="checkbox-' + index + '" data-tid="' + tid + '">' + inputText + '</label><input type="checkbox" id="checkbox-' + index + '" data-tid="' + tid + '" data-val="' + inputText + '" /></span>';

Aside from the fact that this code was hard to read (and therefore would be more difficult to maintain), the same code was used with no significant modification in three separate locations in the pull-request.

In PHP, most developers familiar with Drupal would immediately reach for one of the well-known parts of Drupal's theme system, render arrays, theme(), or a *.tpl.php file. In javascript, however, I seldom see much use of Drupal 7's extensive javascript API (also made available in a nicely browseable--though not quite up-to-date--form by nod_).

In this case, the relatively difficult-to-read code, combined with the fact that it was repeated several times across more than one file were clear signs that it should be placed into a theme function.

The Drupal.theme() function in the javascript API works much like theme() in PHP. When using theming functions in PHP, we never call them directly, instead using the theme() function.

In javascript, it's similar; when output is required from a given theme function, we call Drupal.theme() with the name of the theme function required, and any variable(s) it requires.

For example, drupal.org shows the following usage:

Drupal.theme('myThemeFunction', 50, 100, 500);

The example uses Drupal.theme() to call the theme function, myThemeFunction(), and pass it the arguments it requires (50, 100, and 500 in this instance). A theme function can accept whatever number of arguments is necessary, but if your theme function requires more than one parameter, it's good practice to define the function to take a single javascript object containing the parameters required by the function.

So in the case of my code-review, I suggested we use a theme function like this:

/** * Provides a checkbox and label wrapped in a span. * * @param {object} settings * Configuration object for function. * @param {int} settings.index * A numeric index, used for creating an `id` attribute and corresponding * `for` attribute. * @param {string} settings.inputText * The text to display as the label text and in various attributes. * @param {int} settings.tid * A Drupal term id. * * @return {string} * A string of HTML with a checkbox and label enclosed by a span. */ Drupal.theme.checkboxMarkup = function(settings) { "use strict"; var checkboxId = 'checkbox-' + settings.index; var inputText = Drupal.checkPlain(settings.inputText); var checkboxMarkup = ''; // Assemble the markup--string manipulation is fast, but if this needs // to become more complex, we can switch to creating dom elements. checkboxMarkup += '<span>'; checkboxMarkup += '<label data-val="' + inputText + '" for="' + checkboxId + '" data-tid="' + settings.tid + '">'; checkboxMarkup += inputText; checkboxMarkup += '</label>'; checkboxMarkup += '<input type="checkbox" value="' + inputText + '" id="' + checkboxId + '" data-tid="' + settings.tid + '" data-val="' + inputText + '">'; checkboxMarkup += '</span>'; return checkboxMarkup; };

This allowed the calling code to be much simpler:

// Creates themed checkbox. checkboxMarkup = Drupal.theme('checkboxMarkup', { index: i, inputText: $('.inputText').val(), tid: $('.tid') }); $container.append(checkboxMarkup);

The HTML generation is now also more loosely coupled, and more portable, meaning that we can easily use Drupal.theme.checkboxMarkup() elsewhere in this project--or in any other Drupal project.

Categories: Drupal

Pages