Subscribe to feed Planet Drupal
Drupal.org - aggregated feeds in category Planet Drupal
Bijgewerkt: 7 uur 45 min geleden

Drupal Easy: DrupalEasy Podcast 148: 18 Minutes Later

11 uur 22 min geleden
DrupalEasy Podcast 148

WARNING: You have no idea what awaits behind that play button. Take 18 minutes, and call us in the morning. Not for the light of Drupal heart, expectant mothers, or those with liver, neck or back problems. Listen at your own risk.

read more

Categorieën:

Michael J. Ross: Drush for Developers, 2nd Edition

di, 2015/03/31 - 10:05pm
Error: sites/default/files/book reviews/Drush for Developers, 2nd Edition.html not found
Categorieën:

Advomatic: Style guides in Drupal

di, 2015/03/31 - 5:02pm
Heading into Chicago’s Midcamp, my coworker Andy and I were excited to talk to other front end developers about using style guides with Drupal. We decided to put the word out and organize a BOF (birds of a feather talk) to find our kindred front end spirits. Indeed, we found a small group of folks... Read more »
Categorieën:

ERPAL: Agile projects for a fixed price? Yes you can!

di, 2015/03/31 - 4:52pm

In the first part of our blog serie we discovered why we need "objectives" to give projects a solid base to succeed. In this blog post we will describe how to manage agile projects for a fixed price. Doesn't work? Es it does, if you respect some rules and do a detailled planning.

In general you should be careful with agile projects on a fixed price agreement. Both parties, the vendor and the customer should be aware of what this agreement means.

What does that mean exactly? Agile:

Changes are allowed in a running project and they are needed. Especially for large projects, changes need to be allowed to continue work even with changing conditions in the defined goals. As described in the blogpost about 3 rules for setting objectives in projects a project should reach certain goals. Agile methods allow to evaluate milestone deliveries often, validate requirements against the end users and involve the feedback in the next sprint. This ensures that the final project result has really the attributes to be accepted by end users.

Fixed price:

The price is fixed and must not be exceeded.

And where is the problem?

The price to be paid always reflects the value of a service or the result a project should deliver. The price tag is a fixed unit. The price and the value of a project should be in a direct relation, since prices are arbitrary otherwise. As the basis for a good and fair calculated project, the requirement description consisting of performance definition, specification and design is valid. If this is detailed enough, realistic assessments can be made. One of the first steps in a project creating the specifications. The more detailled the better. In contrast, if estimations are not realistic and not understanderstandable, conflicts will inevitably arise at some point during the project. This happens latest when additional expenses arise due to new or changing requirements. If it is not possible to proof the changing requirements objectivly, conflicts may appear as one of the project parties may feel disadventaged. So it is urgently to ensure that services and prices are clearly related and are both traceable and transparent. Then also later occurring changes can be considered smoothly. This is the base to manage agile projects for a fixed price. As you know all detailled requirements and their price tag or estimation, it is possible to change existing requirements that are obsolete with new requirements that appeared. Priorities of in the backlog of all requirements help to stick to the initial estimation. Otherwise it is easy to argument, why the fixed price will be overrun.

Another problem arises when you schedule a buffer without a fixed size. It will never be possible for you to find an explanation for when the buffer is finally exhausted, if you dont have clearly estimated and specified requirements that will help to realize a real change request. Because you do not know how big a change is and what changes have already been posted with what size of the buffer. So you should offer a fixed time schedule and buffer, which can be used for changing requests. These "change requests" have to be transparent and documentated for your costumer. So all parties can understand why sometime the buffer is depleted. This avoids conflicts.

In the next part of the series we will draw attention on the topic "Specifications".

Categorieën:

Drupal Association News: Please help us welcome Matt, Tina, and Bradley

di, 2015/03/31 - 3:49pm

After a very busy year and a half, we're nearly done shoring up on new hires here at the Drupal Association. We’ve been working hard to bring in the best talent around, and are thrilled to announce our three new staff members: Matt, Tina, and Brad!

Matt Tsugawa, CFO, Finance and HR Team

Matt (mtsugawa) is joining the Association as our new CFO, where he will be responsible for Finance and HR, and will help develop and drive the strategy of the organization as a member of our leadership team. He brings a rich professional history with him: he has worked in industries across the country and around the world. Early in his career, Matt worked in Japan as a management consultant at the professional services firms, KPMG and Arthur Andersen. After spending a few years as an analyst and business development manager in New York at A&E Television Networks, Matt returned to Portland, where he was born and raised.

Most recently, Matt worked in the energy efficiency industry as the Head of Finance. He holds a BA from University of Colorado at Boulder and an MBA from Yale. When not at work, Matt enjoys “managing" his three children and overgrown puppy with his wife, and when not doing that, he is an enthusiastic, if not yet expert, practitioner of Brazilian Jiu Jitsu.

Tina Krauss, DrupalCon Coordinator, Events Team

Tina (tinakrauss) is the newest member of the DrupalCon team, and came on board in mid March. As a DrupalCon Coordinator, Tina will work with each con’s volunteers, assist in con programming and logistics, and work with website content. Tina is also focused on customer support and responds to tickets submitted to our Contact Us form related to the Cons.

A native of Germany, Tina moved to Portland, Oregon several years ago, where she currently resides. In her free time, Tina is an adventurer. She loves to travel around the world -- the farther, the better! She also enjoys outdoor activities like hiking, biking, backpacking, skiing, and more.

Bradley Fields, Content Manager, Marcomm and Membership Team

Bradley (bradleyfields) joins the Marketing and Communications team as Content Manager. He will focus on the planning, creation, and maintenance of content—across all of the Association-managed platforms—that engages and strengthens the Drupal community. For the last six years, he worked to help associations, federal agencies, and universities make their content work better for all sorts of users and audiences.

When he is not at his desk, Bradley is curating Spotify playlists, watching one of his 50+ animated Disney movies, on the hunt for great whisky, or reading Offscreen magazine. He wishes he were Batman, but his superhero powers are definitely still under development.

Categorieën:

Drupalize.Me: Funding Core Development with D8 Accelerate

di, 2015/03/31 - 3:15pm

Drupalize.Me and Lullabot together have made a donation of $5,000 to the Drupal 8 Accelerate Fund, becoming an anchor donor of this critical funding initiative. We heartily believe in funding core development and are so excited to be a part of providing a much needed final push to a Drupal 8 stable release. Learn more about how you can be a part of accelerating the release of Drupal 8.

Categorieën:

Deeson: Creative design for community websites

di, 2015/03/31 - 1:53pm

A powerful, branded online community can be a great way to promote interaction between a brand and its users.

It's often much more successful than relying solely on pre-designed social media platforms.

At Deeson we’ve built plenty of community sites and we’ve helped organisations develop and deliver their community strategies too. 

As a digital designer, I wanted to take a look at how creative design is being used across the web to help create a more engaging experience for members in online communities.

Long gone are the days when forums were just long lists of grey gradient boxes, with a place reserved for only the highest tech-savvy geeks.

In 2015 they can be bright, engaging, highly topical and definitely not to be hidden at the bottom of your website.

 

Don’t be afraid to let your brand come through

Macmillan Cancer Support is an example I like of an online community that takes a holistic approach. The charity has embraced its branding strategies from across print and advertising, successfully pulling them into one effective online resource.

Covering such a sensitive issue and with the primary purpose as a charity to provide support to others, the brand and online forum needs to be informal, approachable and familiar. Careful layout and colour palette choices help achieve this. The instantly recognisable Macmillan typeface reinforces brand trust.

As a charity that deals with cancer, the topics and emotions when using the resource can be very overwhelming for a user.  The design here does a very good job of counteracting this by breaking each section of the community down into smaller accessible blocks of information.

Posts of the week and feature quotes are highlighted with the bright green and blue colour palette, but do not over power the more detailed threads of conversation that can be scanned easily too.

Encourage user participation

Online communities can be a great tool to generate content outside the services of your own team.

Not only can this broaden topics and save money, it also makes users feel valued and involved.

The Buzzfeed Community, ‘home for awesome posts created by BuzzFeeders', is one of the most successful examples of this.

With the rise of social media came the unstoppable need to gain online credibility and profile. A leaderboard page ranking top posts and users is the perfect mechanism for BuzzFeed to successfully play on this thirst for online fame and self promotion.

Larger than normal profile images, a unique set of designed award virtual stickers and a delightful visual rating system of ‘cat power’ certainly provides encouragement to post valuable submissions.

The design of this online community is somewhat cringeworthy but very well considered and tailored to the audience.

Unlike some other communities, the user's main purpose here is often not to gain a specific answer from the site, but to browse freely until something sparks interest.

Large bold story titles and on trend icons over thumbnails are the perfect tool for free spirited navigation.

Consider your audience

It doesn’t always have to be text heavy and not all communities need to focus around conversation.

DIY is a fantastic online community for kids that encourages them to develop skills across a huge range of subjects - its main feature is delightful illustrations.

Full of creativity, with a unique badge drawn for every skill set, it remains on trend with flat design and the merging of pastel and bright colours.

Every page is instantly visually engaging, perfect for the target audience.

The community works by allowing members to upload videos and images of them completing a certain skill task. This instantly provides a visual portfolio for each member that children can engage with.

Buttons are large and accessible and the navigation is simple to use, with another unique set of icons.

As a neat little commemoration to the origin of earning 'skill set' badges (from the likes of Scouts and Girl Guides), you can purchase hand-sewn patches to show off the illustrated badges you’ve earned, offline.

Consider medium

It’s not just children’s online communities that benefit from avoiding text heavy sites. For brands like YouTube and Spotify, the main medium associated is video and sound so it makes sense to make these the feature.

Soundcloud, an audio platform for sharing and promoting originally created sounds, is doing exactly that through creative visuals of sound.

Rather than opting for simple play button and song title, a visualisation of each soundtrack is the feature of each post. A creative display that is both engaging and informative.

Community members' comments can also be placed along exact positions of tracks, removing the need to pause and type out the time you're referring to.

This simple design idea is a great example of finding creative ways to address specific subject user needs and it is addressed with great attention to detail.

The brand's Orange is re-introduced to mark which sections have been played and the background to the player is customisable. This takes in to account that community members have their own 'brands' they may want to display.

Don’t forget that simplicity can work

Lonely Planet’s forum may not be the most groundbreaking in design, but it’s simple, clean, modern and effective. Covering a broad range of topics and conversations, the amount of content could easily become overwhelming, so in this case the design is better stripped back and decluttered.

With a clean menu to the left, the main content paragraphs sit to the right with a short, readable line length and generously spaced line height for maximum readability.

The design is minimal, with titles differentiated in the brand blue. Its only flaw would perhaps be the slightly small font size used on the navigation, which could prove negative to accessibility.

The online Lego community also keeps it simple, but has a creative addition to tools available within forum conversations.

Expanding on the ever popular emoticon series, now standard with most phones, Lego has devised their own set of characterised Lego heads. Bringing in this iconic shape allows users to subtly interact further with the brand.

Overall, the design of an online community should consider your existing brand, the community members and the purpose of the community.

Sometimes a huge number of features is not always best and the information in the community needs to speak louder than the members or brand. Equally, it’s good to get creative and break away from the dated, plain, grey forum list.

Categorieën:

Deeson: Google has a new algorithm, will your site be judged as mobile-friendly?

di, 2015/03/31 - 11:33am

What is it and what does it mean?

Last week Google officially confirmed suspicions that they are due to release a mobile ranking algorithm. The update, due to be released on 21st April 2015, will mean that mobile-friendly websites will be given a higher ranking within mobile search results.  

When making the announcement, Google said they expect a significant change, with some sources saying it will have a bigger impact than both their Panda and Penguin updates. With 50% of all Google searches coming from a mobile device - I certainly think so too!

The new algorithm will be applied globally meaning that the update will affect mobile searches and results in all countries, across all languages at the same time - rather than being phased in country by country.

It’s real-time!

For those of you panicking at the deadline, do not fear (just yet). Google will review your site in real-time meaning that once you’ve updated your design, the next time Google trawl your site they’ll identify it as mobile friendly.

With that in mind, it’s important to remember that this works both ways. If you update your site so it is unfriendly, Google’s algorithm will kick in, which may have a negative effect on your ranking.

It’s good news for those who have part-friendly sites (e.g. your entire site is friendly but parts are not) as Google will be working on a page by page basis. Google will identify the friendly pages but the unfriendly sections will not cause your entire site to be marked negatively - phew!

You’re already being labelled.

You may have already seen, but Google has already got the ball rolling with this latest update. In an effort to help mobile searchers know which sites are mobile-friendly, they have added a text label under the URL (near the snippet) that reads “Mobile-friendly’.   

Discussing the recent label additions Google said, “Users will find it easier to get relevant, high quality search results that are optimised for their devices”. Personally, I’ll always choose a mobile friendly search result over non-labelled one when on the move.

As the fight for the top positions in Google becomes ever-more competitive, it’s important that you identify any potential advantages over your competitors - and this certainly is one. In a recent report by Alexa (October 2014) which reviewed the the top 1000 sites, just 18% of them were mobile friendly - and these are the big guns!

Mobile users hold a grudge

Figures show that 61% of users are unlikely to return to a mobile site they’ve had trouble with. Of those, 40% said they would then go on to visit a competitor's site instead. These figures emphasise the huge importance of making your site user-friendly across all devices, particularly if you have e-commerce.

According to Nielsen, 87% of mobile users used their mobile device for shopping activities such as searching for a product or service, price comparisons, or brick & mortar address search. Having a seamless experience across all devices can have a big effect on the amount of users that finally go through to purchase.

What can I do?

There are a number of things you to can do to help make your site more mobile friendly and give yourself greater chance of obtaining a mobile friendly ‘label’. It all depends on what the Googlebot detects when it’s trawling your site, it’s looking for the following:

  • The site avoids software that is not common on mobile devices e.g Adobe Flash

  • The site uses text that is readable without zooming

  • The site sizes content to the screen so users don’t have to scroll horizontally or zoom

  • The site places links far enough apart so that the correct one can be easily tapped

Basic example showing a mobile-friendly layout.

If you’re unsure, there are two easy ways to check to see whether your site is mobile-friendly or not. These are:

  • The simple one: look up your site on a phone yourself and judge.

  • Use the Google Mobile-Friendly Tool to see if Google thinks you’re mobile-friendly.

Final thoughts.

  • To stay ahead of your competitors and provide a seamless experience for your users, updating your site so it’s mobile friendly is a no-brainer. Not only will it give you better chance of retaining customers but it will give you more klout with the big search engines.

  • As more and more sites begin refreshing their design, it’s important to be ahead of the trend and not seen to be lagging behind your competitors. Run tests on your site to make sure that your site is mobile-friendly and meets the requirements set by Google’s new algorithm.

  • If you have any questions surrounding mobile friendly design, SEO or are looking to update your site design, just drop us a line.

Image Credit: SabianMaggy

Categorieën:

Deeson: What makes a good digital strategist?

di, 2015/03/31 - 11:28am

Strategy has always fascinated me.

The intellectual challenge of developing innovative yet rationale responses to a unique context is something I'm really passionate about.

Digital strategy is all too often conflated with knowing which social media channels to be on or whether you should have a mobile app. But to be a good digital strategist you've got to know more than your Vines from your Meerkats.

I've been thinking about what sort of traits make someone a good digital strategist and I'm firmly convinced that the underlying strategic nous isn't something people are born with.

With focused personal development and discipline the traits of an effective strategist can be quite easily developed. 

Combining these traits with a professional curiosity and thirst for knowledge about the world around is what makes a good digital strategist.

So what do good digital strategists do to keep their skills sharp?

Here are my top five ways that digital strategists can stay on top of their game.

  1. Act like a counsellor

    As a strategist, you're helping a brand, organisation or person solve a problem. At the early stages of planning you should be absorbing more information than you're providing. As the Greek philosopher Epictetus wrote "We have two ears and one mouth so that we can listen twice as much as we speak."

    In a briefing session, probe the problem and interrogate the request to determine the true goal. A good strategist is like a good counsellor, reflective, intuitive and never pushy; they talk about you more than themselves.

    'Counselling' is essential to a strategist as it helps them develop the insights which are so critical to creating the final plan. 

  2. Never stop thinking 

    Whilst it's not healthy to be working constantly, a good strategist just can't help analysing campaigns she sees in her daily life.

    When watching TV ads, she wonders what led the creative team to sit around and devise that particular commercial. A good strategist has 'x-ray vision' when looking at other people's marketing activity- an ability to see through the consumer facing proposition, right back to the brief.   

  3. Show empathy

    Empathy is one of the key attributes of a good strategist; the ability to put themselves in another's shoes.

    Strategists need to be able to see across 'lines' in society, unaffected by taboo, moral issues, class or race. If a strategist is unable to put themselves in the consumer's shoes, they won't be able to succesfully relay the needs of the brand or organisation to them.   

  4. Be the glue

    A strategist should be the 'glue' in your campaign team, understanding the professional and personal needs of each contributor. She should be able to draw together findings using stats, creative insight and consumer research.

    The strategist must be the 'voice of reason' in collaborative sessions, listening and encouraging, whilst reigning back overconfidence, even in their superiors.   

  5. Quiet confidence

    A strategist is often a 'thinker', who prefers to absorb information and work alone to come up with ideas to present back to the team.

    Though they may spend a good proportion of their time in quiet contemplation, they're by no means a wallflower. When a strategist gets up to present, the client sits back and listens- they're well-informed, interesting and confident. You'll find most heads nodding as they present their insights.   

In truth, a strategist is simply one of many people contributing to a problem solving expedition. 

However their unique capacity to join up insight from across a marketing team means they are essential for building a successful digital proposition.

Whilse individual disciplines focus heavily on their own area, the strategist must be able to take a holistic view of the evidence and devise a clever, effective solution. 

Sounds simple in theory, yet fascinatingly complex in practice - which is probably why I enjoy it so much!

 

Categorieën:

Web Wash: How to Control Summary Text using Smart Trim in Drupal 7

di, 2015/03/31 - 10:36am

The "Long text and summary" field has a pretty handy formatter called "Summary or trimmed". This will display a summary, if one is supplied, or Drupal will simply trim the text and display it.

The problem with this formatter is that you can't trim the summary. For example, if an editor adds three paragraphs into the summary section, then the whole summary is shown. But sometimes you may need control over how much of the summary is displayed. This is especially true if your design requires the teaser to have a consistent height.

What's the best way of offering a summary to your editors that also trims it? Enter Smart Trim.

The Smart Trim module is an improved version of the "Summary or Trimmed" formatter and a whole lot more. It does a lot of useful stuff, but the one we want to discuss is the ability to trim summaries.

Categorieën:

Drupal core announcements: Drupal 7 core release on Wednesday, April 1

di, 2015/03/31 - 8:32am
Start:  2015-04-01 (All day) America/New_York Online meeting (eg. IRC meeting) Organizers:  David_Rothstein

The monthly Drupal core bug fix/feature release window is this Wednesday, April 1, and since it has been a while since the last one, I plan to release Drupal 7.36 on that date.

The final patches for 7.36 have been committed and the code is frozen (excluding documentation fixes and fixes for any regressions that may be found in the next couple days). So, now is a wonderful time to update your development/staging servers to the latest 7.x code and help us catch any regressions in advance.

There are three relevant change records for Drupal 7.36 which are listed below. This is not the full list of changes, rather only a list of notable API additions and other changes that might affect a number of other modules, so it's a good place to start looking for any problems:

You might also be interested in the tentative CHANGELOG.txt for Drupal 7.36 and the corresponding list of important issues that will be highlighted in the Drupal 7.36 release notes.

If you do find any regressions, please report them in the issue queue. Thanks!

Upcoming release windows after this week include:

  • Wednesday, April 15 (security release window)
  • Wednesday, May 6 (bug fix/feature release window)

For more information on Drupal core release windows, see the documentation on release timing and security releases, and the discussion that led to this policy being implemented.

Categorieën:

Chen Hui Jing: Drupal 101: Mapping with Leaflet and IP Geolocation

di, 2015/03/31 - 2:00am

Store locators are a useful functionality for businesses who have multiple outlets. Drupal has a number of map rendering modules that allow us to provide store locator functionality. This article will cover the basics of setting up a simple store locator with proximity search functionality.

Create and setup location content type

Required modules

  1. Install the required modules. drush dl addressfield geocoder geofield geophp ctools -y
  2. Enable the required modules. drush en addressfield geocoder geofield geofield_map...
Categorieën:

Drupal for Government: Govermenty forms even more governmenty with FillPDF and Rules

ma, 2015/03/30 - 9:08pm

When working with government agencies the sacred form may raise it's fugly formatted head now and again.  Despite attempts at logic "Wouldn't an XLS spreadsheet be easier for everyone?" it sometimes comes down to what's simpler - gettin' er done vs doin' it right.... and if no one really cares about doin' it right, gettin' er done becomes the (sloppy) way, (half)truth, and (dim) light....

So yeah - I had a form that needed to be pixel perfect so that a state-wide agency could print the forms up and store them in a manilla folder... I started working with Views PDF.  This did generate pdf's... and along with mimemail and rules we were sending PDF's out... but they just weren't looking like folks wanted them... FillPDF - thank you.

To use FillPDF we started by installing pdftk (apt-get install pdftk on ubuntu) and then installing the module as per usual....  here's the rest step-by-step 

Categorieën:

Drupal Association News: Clever Ways to Raise Funds for D8 Accelerate

ma, 2015/03/30 - 6:53pm

What’s the most clever way to raise funds for Drupal? Ask Ralf Hendel of Comm Press in Hamburg Germany.

The Drupal Association is working with the Drupal 8 branch maintainers to provide $250,000 in Drupal 8 Acceleration Grants that will be awarded to individuals and groups, helping them get Drupal 8 from beta to release.

Now The Association needs to raise the funds to support the grants and we are working with the Association Board to kick off a D8 Accelerate fundraiser. We are asking community members to help out and donate here. We all want to get D8 released so we can enjoy all the launch parties!

The good news is that we only need to raise $125,000 as a community because all donations will be matched! The Association contributed $62,500 and the Association Board raised another $62,500 from Anchor Donors: Acquia, Appnovation, Drupalize.me by Lullabot, Palantir.net, Phase2, PreviousNext, and Wunderkraut.

Having Anchor Partners means…
Every dollar you donate is matched, doubling your impact.

Ralf Hendel, CEO of Comm Press, heard the call and took action in the most creative way. Over the last few years, Ralf learned how to play the piano (very well I might add) and he recently held a benefit recital where he played Bach, Schubert, and Skrjabin. Those attending were asked to donate to D8 Accelerate and together they raised €345. Of course, with the matching funds from our Anchor Partners, that contribution is €690.

At The Drupal Association, we are always amazed at the many talents our community has and we are especially thankful to Ralf for sharing his passion for music and Drupal with others and raising these funds.

There’s so many clever ways to raise funds to help D8 get across the finish line. What ideas do you have? Or if feel like going the traditional route, you can donate here.

Thanks for considering this opportunity to get Drupal 8 released sooner. If you would like to learn more about how D8 Accelerate grants are being given out, please read Angie Byron’s blog post.

Categorieën:

Drupalpress, Drupal in the Health Sciences Library at UVA: equipment booking system — managing reservation conflicts with field validation and EntityFieldQuery()

ma, 2015/03/30 - 4:26pm

The first requirement of a registration system is to have something to reserve.

The second requirement of a registration system is to manage conflicting reservations.

Setting up validation of submitted reservations based on the existing reservation nodes was probably the most complex part of this project. A booking module like MERCI has this functionality baked in — but again, that was too heavy for us so we had to do it on our own. We started off on a fairly thankless path of Views/Rules integration. Basically we were building a view of existing reservations, contextually filtering that view by content id (the item that someone was trying to reserve) and then setting a rule that would delete the content and redirect the user to a “oops that’s not available” page. We ran into issues building the view contextually with rules (for some reason the rule wouldn’t pass the nid …) and even if we would have got that wired up, it would have been clunky.

Scrap that.

On to Field Validation.

The Field Validation module offers client-side form validation (not to be confused with Clientside Validation or Webform Validation based on any number of conditions at the field level. We were trying to validate the submitted reservation on length (no longer than 5 days) and availability (no reservations of the same item during any of the days requested).

The length turned out to be pretty straightforward — we set the “Date range2″ field validator on the reservation date field. The validator lets you choose “global” date format, which means you can input logic like “+ X days” so long as it can be converted by the strtotime() function.

 

Field Validation also gives you configurations to bypass the validation criteria by role — this was helpful in our case given that there are special circumstances when “approved” reservations can be made for longer than 5 days. And if something doesn’t validate, you can plug in a custom error message in the validator configuration.

 

With the condition set for the length of the reservation, we could tackle the real beast. Determining reservation conflicts required us to use the “powerfull [sic] but dangerous” PHP validator from Field Validation. Squirting custom code into our Drupal instance is something we try to avoid as much as possible — it’s difficult to maintain … and as you’ll see below it can be difficult to understand. To be honest, a big part of the impetus for writing this series of blog posts was to document the 60+ lines of code that we strung together to get our booking system to recognize conflicts.

The script starts by identifying information about the item that the patron is trying to reserve  (item = $arg1, checkout date = $arg2, return date = $arg3) and then builds an array of dates from the start to finish of the requested reservation. Then we use EntityFieldQuery() to find all of the reservations that have dates less than or equal to the end date request. That’s where we use the fieldCondition() with <= to the $arg3_for_fc value. What that gives us is all of the reservations on that item that could possibly conflict. Then we sort by descending and trim the top value out of the list to get the nearest reservation to the date requested. With that record in hand, we can build another array of start and end dates and use array_intersetct() to see if there is any overlap.

I bet that was fun to read.

I’ll leave you with the code and comments:

<?php //find arguments from nid and dates for the requested reservation $arg1 = $this->entity->field_equipmentt_item[und][0][target_id]; $arg2 = $this->entity->field_reservation_date[und][0][value]; $arg2 = new DateTime($arg2); $arg3 = $this->entity->field_reservation_date[und][0][value2]; $arg3 = new DateTime($arg3); $arg3_for_fc = $arg3->format("Ymd"); //build out array of argument dates for comparison with existing reservation $beginning = $arg2; $ending = $arg3; $ending = $ending->modify( '+1 day' ); $argumentinterval = new DateInterval('P1D'); $argumentdaterange = new DatePeriod($beginning, $argumentinterval ,$ending); $arraydates = array(); foreach($argumentdaterange as $argumentdates){ $arraydates []= $argumentdates->format("Ymd"); } //execute entityfieldquery to find the most recent reservation that could conflict $query = new EntityFieldQuery(); $fullquery = $query->entityCondition('entity_type', 'node') ->entityCondition('bundle', 'reservation') ->propertyCondition('status', NODE_PUBLISHED) ->fieldCondition('field_equipmentt_item', 'target_id', $arg1, '=') ->fieldCondition('field_reservation_date', 'value', $arg3_for_fc, '<=') ->fieldOrderBy('field_reservation_date', 'value', 'desc') ->range(0,1); $fetchrecords = $fullquery->execute(); if (isset($fetchrecords['node'])) { $reservation_nids = array_keys($fetchrecords['node']); $reservations = entity_load('node', $reservation_nids); } //find std object for the nearest reservation from the top $reservations_test = array_slice($reservations, 0, 1); //parse and record values for dates $startdate = $reservations_test[0]->field_reservation_date[und][0][value]; $enddate = $reservations_test[0]->field_reservation_date[und][0][value2]; //iterate through to create interval date array $begin = new DateTime($startdate); $end = new DateTime($enddate); $end = $end->modify( '+1 day' ); $interval = new DateInterval('P1D'); $daterange = new DatePeriod($begin, $interval ,$end); $arraydates2 = array(); foreach($daterange as $date){ $arraydates2 []= $date->format("Ymd"); } $conflicts = array_intersect($arraydates, $arraydates2); if($conflicts != NULL){ $this->set_error(); } ?>
Categorieën:

Yuriy Babenko: Adding custom contexts to UDFs in Acquia Lift

ma, 2015/03/30 - 3:55am

Within the Lift ecosystem, "contexts" can be thought of as pre-defined functionality that makes data available to the personalization tools, when that data exists in the current state (of the site/user/environment/whatever else).

Use cases

The simplest use of contexts is in mapping their data to UDF fields on /admin/config/content/personalize/acquia_lift_profiles. When the context is available, its data is assigned to a UDF field and included with Lift requests. For example, the Personalize URL Context module (part of the Personalize suite) does exactly this with query string contexts.

First steps

The first thing to do is to implement hook_ctools_plugin_api() and hook_personalize_visitor_contexts(). These will make the Personalize module aware of your code, and will allow it to load your context declaration class.

Our module is called yuba_lift:

/**
 * Implements hook_ctools_plugin_api();
 */
function yuba_lift_ctools_plugin_api($owner, $api) {
  if ($owner == 'personalize' && $api == 'personalize') {
    return array('version' => 1);
  }
}

/**
 * Implements hook_personalize_visitor_contexts();
 */
function yuba_lift_personalize_visitor_context() {
  $info = array();
  $path = drupal_get_path('module', 'yuba_lift') . '/plugins';

  $info['yuba_lift'] = array(
    'path' => $path . '/visitor_context',
    'handler' => array(
      'file' => 'YubaLift.inc',
      'class' => 'YubaLift',
    ),
  );

  return $info;
}

The latter hook tells Personalize that we have a class called YubaLift located at /plugins/visitor_context/YubaLift.inc (relative to our module's folder).

The context class

Our context class must extend the abstract PersonalizeContextBase and implement a couple required methods:

<?php
/**
 * @file
 * Provides a visitor context plugin for Custom Yuba data.
 */

class YubaLift extends PersonalizeContextBase {
  /**
   * Implements PersonalizeContextInterface::create().
   */
  public static function create(PersonalizeAgentInterface $agent = NULL, $selected_context = array()) {
    return new self($agent, $selected_context);
  }

  /**
   * Implements PersonalizeContextInterface::getOptions().
   */
  public static function getOptions() {
    $options = array();

    $options['car_color']   = array('name' => t('Car color'),);
    $options['destination'] = array('name' => t('Destination'),);

    foreach ($options as &$option) {
      $option['group'] = t('Yuba');
    }

    return $options;
  }
}

The getOptions method is what we're interested in; it returns an array of context options (individual items that can be assigned to UDF fields, among other uses). The options are grouped into a 'Yuba' group, which will be visible in the UDF selects.

With this code in place (and cache cleared - for the hooks above), the 'Yuba' group and its context options become available for mapping to UDFs.

Values for options

The context options now need actual values. This is achieved by providing those values to an appropriate JavaScript object. We'll do this in hook_page_build().

/**
 * Implements hook_page_build();
 */
function yuba_lift_page_build(&$page) {
  // build values corresponding to our context options
  $values = array(
    'car_color' => t('Red'),
    'destination' => t('Beach'),
  );

  // add the options' values to JS data, and load separate JS file
  $page['page_top']['yuba_lift'] = array(
    '#attached' => array(
      'js' => array(
        drupal_get_path('module', 'yuba_lift') . '/js/yuba_lift.js' => array(),
        array(
          'data' => array(
            'yuba_lift' => array(
              'contexts' => $values,
            ),
          ),
          'type' => 'setting'
        ),
      ),
    )
  );
}

In the example above we hardcoded our values. In real use cases, the context options' values would vary from page to page, or be entirely omitted (when they're not appropriate) - this will, of course, be specific to your individual application.

With the values in place, we add them to a JS setting (Drupal.settings.yuba_lift.contexts), and also load a JS file. You could store the values in any arbitrary JS variable, but it will need to be accessible from the JS file we're about to create.

The JavaScript

The last piece of the puzzle is creating a new object within Drupal.personalize.visitor_context that will implement the getContext method. This method will look at the enabled contexts (provided via a parameter), and map them to the appropriate values (which were passed via hook_page_build() above):

(function ($) {
  /**
   * Visitor Context object.
   * Code is mostly pulled together from Personalize modules.
   */
  Drupal.personalize = Drupal.personalize || {};
  Drupal.personalize.visitor_context = Drupal.personalize.visitor_context || {};
  Drupal.personalize.visitor_context.yuba_lift = {
    'getContext': function(enabled) {
      if (!Drupal.settings.hasOwnProperty('yuba_lift')) {
        return [];
      }

      var i = 0;
      var context_values = {};

      for (i in enabled) {
        if (enabled.hasOwnProperty(i) && Drupal.settings.yuba_lift.contexts.hasOwnProperty(i)) {
          context_values[i] = Drupal.settings.yuba_lift.contexts[i];
        }
      }
      
      return context_values;
    }
  };

})(jQuery);

That's it! You'll now see your UDF values showing up in Lift requests. You may also want to create new column(s) for the custom UDF mappings in your Lift admin interface.

You can grab the completed module from my GitHub.

Tagsdrupal planetdrupaldrupal 7liftpersonalization
Categorieën:

Chen Hui Jing: The one without sleep

ma, 2015/03/30 - 2:00am

So I recently participated in my first ever hackathon over the weekend of March 28. Battlehack Singapore to be exact (oddly, there was another hackathon taking place at the same time). A UX designer friend of mine had told me about the event and asked if I wanted to join as a team.
Me: Is there gonna be food at this thing?
Her: Erm…yes.
Me: Sold!
Joking aside, I’d never done a hackathon before and thought it’d be fun to try. We managed to recruit another friend and went as a team of three.

The idea

The theme of the hackathon was to solve a local...

Categorieën:

Paul Rowell: My journey in Drupal, 4 years on

zo, 2015/03/29 - 10:38pm

I’m approaching the 4 year mark at my agency and along with it my 4 year mark working with Drupal. It’s been an interesting journey so far and I’ve learned a fair bit, but, as with anything in technology, there’s still a great deal left to discover. This is my journey so far and a few key points I learned along the way.

Categorieën:

Victor Kane: Getting Started with a Real World Application on platform.sh

zo, 2015/03/29 - 8:20pm

This is the second in a series of articles involving the writing and launching of my DurableDrupal Lean ebook series website on platform.sh. Since it's a real world application, this article is for real world website and web application developers. If you are starting from scratch but enthusiastic and willing to learn, that means you too. I'm fortunate enough to have their sponsorship and full technical support, so everything in the article has been tested out on the platform. A link will be edited in here as soon as it goes live.

Diving in

Diving right in I setup a Trello Kanban Board for Project Inception as follows:

Both Vision (Process, Product) and Candidate Architecture (Process, Product) jobs have been completed, and have been moved to the MVP 1 column. We know what we want to do, and we're doing it with Drupal 7, based on some initial configuration as a starting point (expressed both as an install profile and a drush configuration script). At this point there are three jobs in the To Do column, constituting the remaining preparation for the Team Product Kickoff. And two of them (setup for continuous integration and continuous delivery) are about to be made much easier by virtue of using platform.sh, not only as a home for the production instance, but as a central point of organization for the entire development and deployment process.

Beginning Continuous Integration Workflow

What we'll be doing in this article:

read more

Categorieën:

Drupal @ Penn State: Improve User Experience by Ajaxing Your Drupal Forms

zo, 2015/03/29 - 1:02pm

Drupal's Form API has everything that we love about the Drupal framework. It's powerful, flexible, and easily extendable with our custom modules and themes. But lets face it; it's boooorrrrriinnnnggg. Users these days are used to their browsers doing the heavy lifting. Page reloads are becoming fewer and fewer, especially when we are expecting our users to take action on our websites. If we are asking our visitors to take time out of their day to fill out a form on our website, that form should be intuitive, easy to use, and not distracting.

Categorieën: