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

  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • 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.
Kategória: 
Leírás

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:

Dátumformátum
[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]

Dátumformátum-típus

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ó.

Hozzászólások

Wow, beautiful portal. Thnx

Wow, beautiful portal. Thnx ...

sodeistvieomsk. 222pass.

kostakopoulos. phu-waing.

say thanks to a lot for your

say thanks to a lot for your internet site it helps a great deal.

samsung. ysiaq. cresign.

information that should never

information that should never be on the miss , apart from that I also have Info Hebat
about health review that disease Tips Mengatasi Maag

You've gotten one of the

You've gotten one of the better online sites.

Great website! It looks

Great website! It looks extremely expert! Sustain the good job!

expofocus. sodeistvieomsk.

langroud118. ankorona.

ysiaq. malosh.

I have learn a few just right

I have learn a few just right stuff here. Certainly worth bookmarking for revisiting.

I surprise how much effort you put to create this type of magnificent
informative site.

Also visit my blog ... pharmacy near me

You have got terrific

You have got terrific knowlwdge here.

kcwzz. sleepmoney.

peleon. smertforum.

die-leichte-kocherei.

Hello, I do think your blog

Hello, I do think your blog could possibly be having web browser compatibility problems.
Whenever I take a look at your website in Safari, it looks fine however
when opening in IE, it has some overlapping issues. I just wanted to provide you with a quick heads up!
Other than that, great website!

Also visit my web blog :: walmart pharmacy on

What's happening, great

What's happening, great web-site you possess presently.

formlessro. azatweb.

Great looking internet site.

Great looking internet site. Presume you did a bunch of your own coding.

catalinchiru. amiyalee.

borsalino-verbier.

Yes! Finally something about

Yes! Finally something about prednisone 10mg taper directions.

My web-site; taking prednisone

Great looking web site.

Great looking web site. Presume you did a bunch of your very own coding.

mothercenter.

js-pcb. sodeistvieomsk.

Link exchange is nothing else

Link exchange is nothing else but it is only placing the other person's blog link on your page at appropriate place and other person will also do same in favor of you.

Very beneficial look forth to

Very beneficial look forth to coming back.

bestgamer. eosecuador.

smertforum. clevio. molweb.

cheonmugeuk. unisotong.

Hey there are using Wordpress

Hey there are using Wordpress for your blog platform?
I'm new to the blog world but I'm trying to get started and set up my own.
Do you require any html coding knowledge to make your own blog?
Any help would be really appreciated!

Feel free to visit my homepage; canadian pharmacies shipping to usa

Truly this is a advantageous

Truly this is a advantageous websites.

vytrvalost.

formlessro. clevio.

Appreciate this post. Let me

Appreciate this post. Let me try it out.

Feel free to visit my webpage ... canadian pharmacies shipping to usa

You have got among the finest

You have got among the finest web-sites.

umsolution. pyosewook.

clevio. bemanipiracy.

dnineinternational.

My brother suggested I might

My brother suggested I might like this blog. He was entirely right.
This post truly made my day. You cann't imagine just how much time
I had spent for this info! Thanks!

Feel free to surf to my page online pharmacies in canada

einstein. jabulaniholdings.

Hi there friends, pleasant

Hi there friends, pleasant paragraph and nice urging commented at this
place, I am really enjoying by these.

Also visit my blog ... canadadrugsonline.com

Terrific web site you've in

Terrific web site you've in here.

adopt10plus. florapos.

s2slc. lovran-apartments.

borsalino-verbier.

Hmm it seems like your site

Hmm it seems like your site ate my first comment (it was super
long) so I guess I'll just sum it up what I had written and say, I'm thoroughly enjoying your blog.

I as well am an aspiring blog blogger but I'm still new to everything.
Do you have any recommendations for inexperienced blog
writers? I'd definitely appreciate it.

Take a look at my web site - prednisone

Incredibly user friendly

Incredibly user friendly site. Astounding details readily available on couple of gos to.

Hozzászólás

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.