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

I am really impressed with

I am really impressed with your writing skills and also with the layout on your weblog.

Is this a paid theme or did you customize it yourself?
Anyway keep up the nice quality writing, it's rare to see a nice
blog like this one nowadays.

You are so interesting! I

You are so interesting! I don't think I've read through something like this before.
So good to discover somebody with some genuine thoughts on this
subject matter. Seriously.. thanks for starting this up.
This web site is something that is required on the web, someone with
some originality!

Hmm is anyone else

Hmm is anyone else encountering problems with the images on this blog loading?
I'm trying to find out if its a problem on my end or if it's the blog.
Any feed-back would be greatly appreciated.

Hello, always i used to check

Hello, always i used to check website posts here early
in the daylight, as i love to find out more and more.

This design is spectacular!

This design is spectacular! You definitely know how to keep
a reader amused. Between your wit and your videos, I was
almost moved to start my own blog (well, almost...HaHa!)
Excellent job. I really loved what you had to say,
and more than that, how you presented it. Too cool!

Many thanks, this site is

Many thanks, this site is extremely helpful.

Now it's time to decide your

Now it's time to decide your specific investments.

Great delivery. Great

Great delivery. Great arguments. Keep up the
good spirit.

All varieties of investments

All varieties of investments come with sure risks.

At this time it looks like

At this time it looks like BlogEngine is the preferred blogging platform available
right now. (from what I've read) Is that what you're using
on your blog?

sleepmoney. rier. blog.

Hey there! I've been

Hey there! I've been following your web site for a long time now
and finally got the bravery to go ahead and give you a
shout out from Porter Tx! Just wanted to tell you keep up
the great work!

It's very effortless to find

It's very effortless to find out any topic on web
as compared to books, as I found this post at this site.

Howdy, I do believe your web

Howdy, I do believe your web site could be having internet browser compatibility problems.
When I take a look at your website in Safari, it looks fine however when opening
in Internet Explorer, it's got some overlapping issues.
I merely wanted to give you a quick heads up!
Apart from that, excellent blog!

Hello, the whole thing is

Hello, the whole thing is going nicely here and ofcourse every one is sharing data,
that's genuinely excellent, keep up writing.

Great site you have here..

Great site you have here.. It's difficult to find high quality
writing like yours nowadays. I honestly appreciate individuals like you!
Take care!!

Attractive section of

Attractive section of content. I just stumbled upon your blog
and in accession capital to assert that I
acquire in fact enjoyed account your blog posts.
Anyway I will be subscribing to your feeds and even I achievement you access
consistently quickly.

Link exchange is nothing else

Link exchange is nothing else however it is simply placing the other person's weblog link on your page at proper place and
other person will also do similar for you.

My brother recommended I

My brother recommended I might like this blog. He used to be
totally right. This publish truly made my day. You
cann't imagine simply how a lot time I had spent for this info!
Thank you!

Thanks a ton! It a great web

Thanks a ton! It a great web page.

I have been surfing online

I have been surfing online more than 3 hours today, yet I never found any interesting article
like yours. It's pretty worth enough for me.
In my opinion, if all webmasters and bloggers made good content
as you did, the internet will be a lot more useful than ever before.

Thanks! It is definitely an

Thanks! It is definitely an fantastic website!

Peculiar article, exactly

Peculiar article, exactly what I was looking for.

It's remarkable for me to

It's remarkable for me to have a site, which
is valuable in support of my knowledge. thanks
admin

It's going to be ending of

It's going to be ending of mine day, except before ending I am reading this wonderful piece of writing to increase
my know-how.

If you want to take a good

If you want to take a good deal from this post then you have
to apply these strategies to your won web site.

Greetings, neat web page you

Greetings, neat web page you possess in here.

Wonderful, what a blog it is!

Wonderful, what a blog it is! This web site gives valuable data to us, keep it
up.

Every weekend i used to go to

Every weekend i used to go to see this website, for the reason that i wish for enjoyment, as this this site conations truly fastidious funny data too.

Fantastic Site, Maintain the

Fantastic Site, Maintain the beneficial work. With thanks!|

Thanks for sharing your info.

Thanks for sharing your info. I really appreciate your efforts
and I am waiting for your next post thank you once again.

khda.kr. exodium.

Heya i am for the primary

Heya i am for the primary time here. I came across this board and I to find It really helpful & it helped me out much.
I'm hoping to give something again and aid others such as you aided me.

malosh. stayhere.

Attractive section of

Attractive section of content. I just stumbled upon your blog and in accession capital to assert that I get actually enjoyed account your blog posts.
Anyway I'll be subscribing to your feeds and even I achievement you
access consistently rapidly.

I’ve been having some

I’ve been having some problems compiling my lists as of late.
I’m running this in hopes of creating a new up to date list.
Stay tuned and visit my website soon. I hope to add a new list
in the not so distant future.

Its like you read my mind!

Its like you read my mind! You appear to know a lot
about this, like you wrote the book in it
or something. I think that you can do with some pics to drive
the message home a little bit, but other than that, this is wonderful
blog. An excellent read. I will certainly be back.

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.