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.
  • 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.
Category: 
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ó.

Comments

Very good blog! Do you have

Very good blog! Do you have any tips and hints for aspiring writers?
I'm hoping to start my own website soon but
I'm a little lost on everything. Would you propose starting with a free platform like
Wordpress or go for a paid option? There are so many options out there that I'm completely confused ..
Any recommendations? Cheers!

The posts is quite exciting.

The posts is quite exciting.

I got this website from my

I got this website from my buddy who told
me about this site and at the moment this time I am browsing this website and reading very informative content here.

An impressive share! I have

An impressive share! I have just forwarded this onto a friend
who was conducting a little homework on this. And he actually bought
me lunch due to the fact that I found it for him...
lol. So let me reword this.... Thank YOU for the meal!!
But yeah, thanx for spending some time to talk about this topic here on your website.

I enjoy this website - its so

I enjoy this website - its so usefull and helpfull.

It's remarkable to pay a

It's remarkable to pay a quick visit this site and reading the views of all colleagues on the topic of this piece of writing, while I am
also keen of getting knowledge.

Greetings from California!

Greetings from California! I'm bored to tears at work so I decided to check out your website on my
iphone during lunch break. I really like the info you present here and can't wait to take a look when I get home.
I'm shocked at how quick your blog loaded on my mobile ..
I'm not even using WIFI, just 3G .. Anyhow, great blog!

It is perfect time to make a

It is perfect time to make a few plans for the future and it is time to be happy.
I have read this post and if I may just I desire to
suggest you few attention-grabbing things or tips. Maybe you can write subsequent articles relating
to this article. I wish to learn more issues about it!

If you desire to increase

If you desire to increase your familiarity simply keep visiting this web site and be updated
with the most recent news posted here.

Stop by my web blog - dyson replacement parts

Great web site! It looks

Great web site! It looks extremely expert! Keep up the great work!

You've made some really good

You've made some really good points there.
I checked on the web for additional information about the issue and found most people will go along with your views on this site.

I love your blog.. very nice

I love your blog.. very nice colors & theme. Did you make
this website yourself or did you hire someone to do it for you?
Plz answer back as I'm looking to create my own blog and would like to find out where u got this from.
thanks

Here is my webpage - impotence remedy

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.

anapa-alrosa. deryun.

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.

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.

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.

You've astonishing

You've astonishing information right here.

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.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Internal paths in double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or relative path.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <del> <img>
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <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].
  • Each email address will be obfuscated in a human readable fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.