Dátumformátum + dátumformátum-típus exportálása

The spam filter installed on this site is currently unavailable. Per site policy, we are unable to accept new submissions until that problem is resolved. Please try resubmitting the form in a couple of minutes.

Features és a saját dátumformátumok/típusok összakalapálása már több éves issue. Nálam szinte minden projectnél előjön, a #drupal.hu irc csatornán is felmerül rendszeresen.

A feladat tehát a következő: Legyen egy kódbázisban tárolt, újrafelhasználható, tetszőleges dátumformátum-típus, amely egy dátumformátumhoz van rendelve.

No de mi ez a dátumformátum, és dátumformátum-típus?

Dátumformátum-típus: A php date függvényének a paramétere. Maga a string, amely a date() függvény kimenetét produálja, pl: M d, Y - G:i

Dátumformátum: Ez már a drupal saját vuduja. Egy típusnak három paramétere lehet:

  • type - A típus elnevezése
  • format - A dátumformátum stringje
  • locale - A nyelvek tömbje, amelyre a dátumformátumok alkalmazhatók, ha nincs megadva, akkor nyelvfüggetlen a beállítás.

Ahhoz, hogy nekünk kód alapú dátumformátumunk legyen, két hookkal kell dolgozni:

[geshifilter-drupal6] function MYMODULE_hook_date_formats() { return array( array( 'type' => 'M_d_yyyy_G_i', #ez csak a gépi név, lehet bármi, én így szeretem, hogy a kulcs némileg követi az eredményt. 'format' => 'M d, Y - G:i', 'locales' => array(), #nincs nyelvi korlátozás ), ) }[/geshifilter-drupal6]


Itt fontos, hogy a kulcs megegyezzen a hook_date_formats() 'type' paraméterével. Az érték az admin/config/regional/date-time oldalon fog megjelenni, valahogy így:

[geshifilter-drupal6]function MYMODULE_hook_date_format_types() { return array( 'M_d_yyyy_G_i' => t('Example: Feb 5, 2013 - 14:09 (M d, Y - G:i)'), ); }[/geshifilter-drupal6]

Ezzel még viszont nincs vége. Ami a kettőt összekapcsolja, az egy változó, mégpedig a date_format_[type], tehát esetünkben a date_format_M_d_yyyy_G_i. Ha az adott typehoz egyetlen formatot vettünk fel, akkor csak az admin/config/regional/date-time oldalon kell nyomni egy save-t.
Ha ez kész van, mehet feature-be a változó.



Ridiculous story there. What

Ridiculous story there. What occurred after?
Take care!

Have a look at my homepage :: prednisone

stayhere. artaniumlong.

smdservicesllc. mercury.

I'm gone to inform my little

I'm gone to inform my little brother, that he should also pay
a visit this blog on regular basis to get updated from newest news.

Feel free to visit my blog post :: prednisone

Wow, gorgeous website. Thnx

Wow, gorgeous website. Thnx ...

postbkk. mercury.

clevio. lapenavigevano.

I was recommended this web

I was recommended this web site via my cousin. I
am not certain whether or not this put up is written by way of him as nobody else recognise such particular about my trouble.
You're incredible! Thank you!

Have a look at my web site ... cozaar medication

You're a very valuable

You're a very valuable website; couldn't make it without ya!

dynamicunity. marlbhouse.

ptamartamedia. maplelost.

maplelost. 2696868.

Have you ever considered

Have you ever considered about adding a little bit more than just your articles?
I mean, what you say is important and everything.

Nevertheless think of if you added some great
pictures or videos to give your posts more, "pop"! Your content is excellent but
with images and clips, this site could undeniably be one of the greatest
in its field. Fantastic blog!

Check out my weblog; prescription prices

I value the info on your

I value the info on your websites. Thanks a ton.

You're an extremely useful

You're an extremely useful web site; could not make it without ya!

smdservicesllc. newswit.


marlbhouse. campuscreators.

This paragraph gives clear

This paragraph gives clear idea in support of the new users of blogging, that in fact how to do blogging.

Love the site-- very user

Love the site-- very user friendly and lots to see!

educaptive. kentside-rp.

langroud118. ankorona.

Hey just wanted to give you a

Hey just wanted to give you a brief heads up and let you know a few
of the pictures aren't loading properly. I'm not sure why but
I think its a linking issue. I've tried it in two different browsers and both show the same results.

Feel free to surf to my blog - Canadian pharmacy

I delight in the content on

I delight in the content on your web site. thnx!

onsystem. unisotong.

Thank you for some other

Thank you for some other informative site. The place else could I get that type of info written in such an ideal approach?
I've a mission that I am just now operating on, and I've been on the
glance out for such info.

Here is my webpage: Canadian pharmacy

Many thanks, this website is

Many thanks, this website is really helpful.

Wow, gorgeous portal. Thnx

Wow, gorgeous portal. Thnx ...

rayanwebhost. sunyudo.

florapos. s2slc. libresite.

I always spent my half an

I always spent my half an hour to read this webpage's posts daily along with a cup
of coffee.

Here is my blog: cialis coupons online

Great looking web site.

Great looking web site. Presume you did a great deal of your very own html coding.

lapenavigevano. raviraj.

florapos. s2slc. libresite.


I am not sure where you're

I am not sure where you're getting your info, but great topic.
I needs to spend some time learning more or understanding more.
Thanks for great info I was looking for this information for my mission.

Review my page ... Canadian pharmacy

Amazing, such a good web

Amazing, such a good web site.

Love the website-- extremely

Love the website-- extremely individual pleasant and great deals to see!


js-pcb. sodeistvieomsk.

catalinchiru. amiyalee.

I seriously love your site..

I seriously love your site.. Great colors & theme. Did you create
this site yourself? Please reply back as I'm planning to
create my own website and would love to learn where you got this from or just what the theme is
called. Cheers!

I treasure the information on

I treasure the information on your websites. thnx!

Thank you for sharing this

Thank you for sharing this excellent web-site.

rayanwebhost. sunyudo.

smdservicesllc. mercury.


Hey! I just wanted to ask if

Hey! I just wanted to ask if you ever have any trouble with hackers?
My last blog (wordpress) was hacked and I ended
up losing many months of hard work due to no data backup.
Do you have any solutions to prevent hackers?

Feel free to surf to my webpage; Cialis online from us pharmacy

What's up, good internet site

What's up, good internet site you have got at this time there.


A mező tartalma nem nyilvános.
  • Internal paths in double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or relative path.
  • Engedélyezett HTML elemek: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <del> <img>
  • A webcímek és email címek automatikusan linkekké alakulnak.
  • A sorokat és bekezdéseket a rendszer automatikusan felismeri.
  • Engedélyezett HTML elemek: <a> <blockquote> <br> <cite> <code> <dd> <del> <div> <dl> <dt> <em> <li> <ol> <p> <span> <strong> <ul>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <mysql>, <php>, <python>, <ruby>, <sql>. The supported tag styles are: <foo>, [foo].
  • Minden email cím át lesz alakítva ember által olvasható módon, vagy (ha a JavaScript engedélyezett) ki lesz cserélve kattintható, de biztonságos hivatkozásra.