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

If some one wishes expert

If some one wishes expert view about running a blog after that
i advise him/her to visit this blog, Keep up the fastidious work.

Amazing things here. I am

Amazing things here. I am very satisfied to see your post.

Thanks a lot and I am taking a look forward to contact you.
Will you kindly drop me a e-mail?

Wow, fantastic blog layout!

Wow, fantastic blog layout! How long have you been blogging for?
you make blogging look easy. The overall look of your web site is fantastic, let alone
the content!

Nice post. I was checking

Nice post. I was checking continuously this blog and I'm impressed!
Very useful information specially the last part :) I
care for such info much. I was seeking this particular information for a very
long time. Thank you and good luck.

Good day! This post couldn't

Good day! This post couldn't be written any better!

Reading this post reminds me of my previous room mate!
He always kept talking about this. I will forward this page to him.
Fairly certain he will have a good read. Many thanks for sharing!

Way cool! Some very valid

Way cool! Some very valid points! I appreciate you writing this write-up plus the rest of the site is also really good.

What's up every one, here

What's up every one, here every one is sharing such knowledge,
thus it's good to read this weblog, and I used to pay a quick visit this blog everyday.

I wanted to thank you for

I wanted to thank you for this great read!! I absolutely enjoyed every
bit of it. I have you book-marked to check out new things you post…

These are genuinely wonderful

These are genuinely wonderful ideas in about blogging.
You have touched some pleasant points here. Any way keep up wrinting.

Jay's Santa Clarita Tree Removal Kings
26174 Las Lanas Ct, Santa Clarita, CA 91355
661-464-1270
laureljefferson09875 [at] gmail [dot] com

Thanks for sharing your

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

I'm really loving the

I'm really loving the theme/design of your website.
Do you ever run into any browser compatibility problems?

A handful of my blog audience have complained about my website not working correctly in Explorer but looks
great in Opera. Do you have any tips to help fix this problem?

We absolutely love your blog

We absolutely love your blog and find almost all of your post's to be just what I'm looking for.
Do you offer guest writers to write content to suit your needs?

I wouldn't mind publishing a post or elaborating on most of the subjects
you write with regards to here. Again, awesome site!

If some one desires to be

If some one desires to be updated with latest technologies then he must be pay
a visit this web site and be up to date daily.

Pretty section of content. I

Pretty section of content. I just stumbled upon your blog and in accession capital to assert
that I get actually enjoyed account your blog posts. Any way I'll be subscribing to your augment and even I achievement you access consistently fast.

I was extremely pleased to

I was extremely pleased to find this page. I need to to thank you
for ones time due to this fantastic read!!
I definitely enjoyed every part of it and
i also have you book-marked to look at new things on your blog.

Hello just wanted to give you

Hello just wanted to give you a quick heads up. The text in your article
seem to be running off the screen in Firefox. I'm not sure if this is a formatting issue or something to do with browser compatibility but
I figured I'd post to let you know. The design look great though!
Hope you get the issue solved soon. Thanks

Very good article. I'm

Very good article. I'm dealing with a few of these issues as well..

Hello there, I discovered

Hello there, I discovered your blog via Google at the
same time as searching for a comparable matter, your web site came up, it appears good.

I've bookmarked it in my google bookmarks.
Hi there, simply became alert to your weblog via Google, and located
that it is really informative. I'm going to watch out for brussels.
I'll appreciate if you proceed this in future.
A lot of other folks will likely be benefited from your
writing. Cheers!
Jim's San Jose Carpet Cleaning
780 S 3rd St, San Jose, CA 95112
3408-351-1063
colettemackie2641 [at] gmail [dot] com

Wow, awesome blog layout! How

Wow, awesome blog layout! How long have you been blogging
for? you make blogging look easy. The whole glance of your website is magnificent, as neatly as
the content!

Jay's Santa Clarita Tree Removal Kings
26174 Las Lanas Ct, Santa Clarita, CA 91355
661-464-1270
laureljefferson09875 [at] gmail [dot] com

Hi I am so happy I found your

Hi I am so happy I found your blog, I really found you by mistake, while I was looking on Digg for something else,
Anyhow I am here now and would just like to say kudos for a
fantastic post and a all round entertaining blog (I also love the
theme/design), I don’t have time to read through it all at the moment but I have book-marked it and also added your RSS feeds, so when I have time
I will be back to read much more, Please do keep up the superb b.

wonderful post, very

wonderful post, very informative. I wonder why the other experts
of this sector don't realize this. You must continue your
writing. I am confident, you have a huge readers' base already!

What's Going down i'm new to

What's Going down i'm new to this, I stumbled upon this I have found It positively helpful
and it has helped me out loads. I'm hoping to contribute & help different customers like its helped
me. Great job.

Remarkable! Its in fact

Remarkable! Its in fact amazing article, I have got much clear
idea about from this paragraph.

Excellent blog you've got

Excellent blog you've got here.. It's difficult to find high-quality writing like yours these days.
I truly appreciate individuals like you! Take care!!

We're a group of volunteers

We're a group of volunteers and opening
a brand new scheme in our community. Your website provided us with useful info to work on. You have performed an impressive activity and our whole group will probably
be thankful to you.

Excellent, what a webpage it

Excellent, what a webpage it is! This webpage provides valuable data to us,
keep it up.

I am regular visitor, how are

I am regular visitor, how are you everybody? This article posted at this site is genuinely fastidious.

whoah this weblog is

whoah this weblog is excellent i like reading your articles.
Keep up the great work! You understand, a lot of individuals are looking round for this info, you
can aid them greatly.

Today, I went to the beach

Today, I went to the beach front with my children. I found a sea
shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She put the shell to her ear and screamed.

There was a hermit crab inside and it pinched her ear.
She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!

continuously i used to read

continuously i used to read smaller articles that also clear their motive, and that is also happening with this post which I am reading at this place.

Excellent post. Keep writing

Excellent post. Keep writing such kind of info on your page.

Im really impressed by your blog.
Hello there, You've performed a great job. I'll certainly digg it and for my part recommend to my friends.
I am sure they'll be benefited from this site.

Hi there! I could have sworn

Hi there! I could have sworn I've visited this web site before but after going through a
few of the posts I realized it's new to me. Regardless, I'm definitely delighted I found it and I'll
be book-marking it and checking back regularly!
Jim's San Jose Carpet Cleaning
780 S 3rd St, San Jose, CA 95112
3408-351-1063
colettemackie2641 [at] gmail [dot] com

Pretty nice post. I just

Pretty nice post. I just stumbled upon your weblog and wanted to say that
I have really enjoyed browsing your blog posts.

In any case I will be subscribing to your feed and I hope you write again very soon!

When someone writes an piece

When someone writes an piece of writing he/she keeps the thought of a user in his/her mind that how
a user can understand it. Thus that's why this paragraph is outstdanding.

Thanks!
Jay's Santa Clarita Tree Removal Kings
26174 Las Lanas Ct, Santa Clarita, CA 91355
661-464-1270
laureljefferson09875 [at] gmail [dot] com

i like it

i like it

I think everything composed

I think everything composed made a great deal of sense.
But, think on this, what if you added a little information? I am not suggesting your
information isn't good, but what if you added something that grabbed folk's attention?
I mean Válasz a hozzászólásra is a little vanilla.
You should glance at Yahoo's front page and see how they create news titles to grab viewers
to open the links. You might add a related video or a related pic or two to get readers excited about everything've got
to say. In my opinion, it would bring your website a
little bit more interesting.

I know this website provides

I know this website provides quality based articles or reviews and additional information, is there any other web page which offers these stuff in quality?

Jay's Santa Clarita Tree Removal Kings
26174 Las Lanas Ct, Santa Clarita, CA 91355
661-464-1270
laureljefferson09875 [at] gmail [dot] com

Spot on with this write-up, I

Spot on with this write-up, I truly feel this site needs far more attention.
I'll probably be returning to read through more, thanks
for the advice!
OutOfSight Hayward Junk Removal Pros
1366 Homestead Ln, Hayward, CA 94545
510-621-6379
joeyedmonds38572 [at] gmail [dot] com

Wonderful article! This is

Wonderful article! This is the type of info that are supposed to be shared around the internet.

Disgrace on Google for no longer positioning this publish higher!
Come on over and seek advice from my website . Thank you =)
Jim's San Jose Carpet Cleaning
780 S 3rd St, San Jose, CA 95112
3408-351-1063
colettemackie2641 [at] gmail [dot] com

If you wish for to get much

If you wish for to get much from this piece of writing then you have to apply such strategies
to your won webpage.

Great delivery. Solid

Great delivery. Solid arguments. Keep up the amazing spirit.

Nice response in return of

Nice response in return of this issue with real arguments and telling the whole thing on the topic of that.

Hurrah! At last I got a

Hurrah! At last I got a website from where I be able
to genuinely get useful information concerning my study and knowledge.

Jay's Santa Clarita Tree Removal Kings
26174 Las Lanas Ct, Santa Clarita, CA 91355
661-464-1270
laureljefferson09875 [at] gmail [dot] com

Terrific work! That is the

Terrific work! That is the type of info that are meant to be shared across the
internet. Shame on the seek engines for no longer positioning
this post upper! Come on over and consult with my web site .
Thanks =)

Hey! This is my first comment

Hey! This is my first comment here so I just
wanted to give a quick shout out and say I truly enjoy reading through your articles.
Can you suggest any other blogs/websites/forums that cover the same subjects?
Thanks a lot!
Jay's Santa Clarita Tree Removal Kings
26174 Las Lanas Ct, Santa Clarita, CA 91355
661-464-1270
laureljefferson09875 [at] gmail [dot] com

Incredible points. Solid

Incredible points. Solid arguments. Keep up the good spirit.

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.