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

langroud118. ankorona.

Wow, that's what I was

Wow, that's what I was exploring for, what a information! present here
at this weblog, thanks admin of this web page.

My site ... northwestpharmacy com canada

Hi there, tidy webpage you've

Hi there, tidy webpage you've got right now.

Your tips is rather useful.

Your tips is rather useful.

maplelost. blikline.

anapa-alrosa. deryun.

stayhere. storyboard-books.

whoah this blog is

whoah this blog is magnificent i love studying
your posts. Stay up the good work! You understand, lots of people are hunting around for this information, you could help them greatly.

Also visit my webpage cialis online pharmacy

Many thanks really handy.

Many thanks really handy. Will certainly share website with my pals.

die-leichte-kocherei.

Great web site. Lots of

Great web site. Lots of useful info here. I am sending it to several
friends ans additionally sharing in delicious. And obviously, thank you to
your sweat!

Have a look at my web-site tadalafil 20mg

2iy6p31

ij8md2xa fotballdrakter

ij8md2xa fotballdrakter kejuvnmaw prqlvb fodboldtrøjer 9fn8cqzxr 4ljka6 fotbollströjor barn f1zeihslmb 21ns0y maglie del calcio bivd68

Thanks, this site is very

Thanks, this site is very handy.

infinity-october.

edu. steerhome.

You've gotten the most

You've gotten the most effective web pages.

I adore this site - its so

I adore this site - its so usefull and helpfull.

clevio. lapenavigevano.

jabulaniholdings.

onsystem. afterservice.

You've astonishing

You've astonishing information right here.

clinic. phim. xplorepets.

elitelaunch. book-dream.

dutchartgroup.

nevershutdown.

sunyudo. dhc2016.

insidefilms. clevio.

At this moment I am going to

At this moment I am going to do my breakfast, after having my
breakfast coming again to read further news.

Look at my website - canadian drugs online

Thanks with regard to

Thanks with regard to supplying many of these substantial content.

ptamartamedia. samsung.

langroud118. clevio.

smertforum. clevio. molweb.

Generally I do not learn post

Generally I do not learn post on blogs, however I wish to say that this write-up very
forced me to check out and do it! Your writing taste has been amazed me.
Thanks, very great post.

My weblog; buy cialis in canada online

Many thanks! It a impressive

Many thanks! It a impressive webpage.

sleepmoney. rier. blog.

dhc2016. campuscreators.

xn---1-6kcatagi3d.

Greetings! This is my first

Greetings! This is my first comment here so I just wanted to give a quick shout out and
say I genuinely enjoy reading your articles. Can you
recommend any other blogs/websites/forums that go over the same subjects?
Thank you!

Here is my webpage - cialis online canada

kostakopoulos.

clevio. kentside-rp.

Quality posts is the

Quality posts is the important to be a focus for the viewers to visit the site, that's what this web page is providing.

Here is my website: canadian pharmacy online

Fantastic Web site, Preserve

Fantastic Web site, Preserve the wonderful job. Thank you so much!|

tecnicosinside. vc-mp.

stayhere. storyboard-books.

samsung. ysiaq. cresign.

You actually make it seem so

You actually make it seem so easy with your presentation but I find this matter to be actually something that
I think I would never understand. It seems too complicated and very broad for me.

I am looking forward for your next post, I will try to get the
hang of it!

Also visit my web blog ... prescription medication

My brother suggested I may

My brother suggested I may like this web site.
He used to be totally right. This submit actually made my day.

You can not consider just how a lot time I had spent for this info!

Thanks!

my blog ... cialis in canada

Mondjuk lehet, hogy csak

Mondjuk lehet, hogy csak régen próbáltam, valahogy egyszerűbb volt a copypaste.
đăng ký w88
w88 cược trực tiếp
W88

Link exchange is nothing else

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

Here is my web page: buy cialis online pharmacy

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.