php

warning: Creating default object from empty value in /home3/slyk/public_html/drupal6/modules/taxonomy/taxonomy.pages.inc on line 34.

Load Drupal Entity - more readable code (easy one-liner)

In my project (on Drupal 7) I'm using EntityFieldQuery alot to get some entities with given conditions, but working with resulting array of execute() function - is boring and makes code dirty IMHO. So I created helper class used only to load entities. Most of the time result is self describing one-liners instead of variables mess. I know it not covers all posibilities of EntityQuery, but 90% of my usage of it is loading Entities with some conditions. With the help of my class, loading one entity with conditions will be as simple as:

$country = (new EntityLoadQuery('country'))->propertyCondition('city_tid', 88)->loadSingle();

Flash + Drupal 7 using AMF Server (setup problems solved)

Seems like today it's very simple to get good comunication betwen flash (frontend) and drupal 7 (backend), good people had wrote just great API to make your work as simple as possible... but there are spots even in the sun. Here are my steps to make them workin' on D7 + Flex SDK 4.5.

Remove 'field_' prefix from custom fields name in Drupal 7 (D7)

I'm creating shop like app with Flex frontend and Drupal 7 backend for our offline retail sotres (it started from simple products availability DB, so I don't wanted to pay for monster all-in-one commercial soft). The point is now it grew up to many lines of code and I wanted to move to AMFservice for Services 3 module to send typed data to Flex...

So the problem is all my custom created fields for nodes is names as 'field_NAME' and it meens I need them in Flex ValueObjects to be same named and the code loses it's redability... use product.title, but ca'nt use product.price... use user.name, but can't use user.phone...

I definenly need to get those 'field_' prefixes out! So you here is a function to remove them.

Drupal reverse pagination

I was waiting for this feature in Drupal 7, but there is not. Reversed pagination is logical and very SEO friendly way of content storing. For example: page number 12 will always have constant collection of nodes showed, so after a year of everyday nodes adding, when there is more than 500 pages - nodes on page number 12 will still be the same, so search engine doesn't need to reindex it over and over again... so ther is no situation when search engine have old index and user can't find needed information when going to your site.

Syndicate content