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

These are genuinely fantastic

These are genuinely fantastic ideas in on the topic of blogging.
You have touched some good things here. Any way keep up wrinting.

This is a very good tip

This is a very good tip especially to those new to the blogosphere.
Brief but very accurate info… Many thanks for sharing this one.
A must read article!

Having read this I thought it

Having read this I thought it was extremely enlightening.
I appreciate you spending some time and energy
to put this informative article together. I once again find myself spending a significant amount
of time both reading and commenting. But so what, it was still
worth it!

This is really interesting,

This is really interesting, You are a very skilled blogger.
I have joined your feed and look forward to seeking more of your excellent post.
Also, I've shared your site in my social networks!

I'm extremely impressed

I'm extremely impressed together with your
writing talents and also with the format on your weblog.
Is this a paid theme or did you customize it yourself?
Anyway stay up the excellent high quality writing, it's uncommon to see a nice blog like this one these days..

Good day! This is my first

Good day! This is my first comment here so I just wanted to give a quick shout out and tell you I really enjoy
reading through your posts. Can you suggest any other blogs/websites/forums that deal with the same topics?
Appreciate it!

Right now it looks like

Right now it looks like Expression Engine is the best blogging platform available right
now. (from what I've read) Is that what you are
using on your blog?

I for all time emailed this

I for all time emailed this website post page
to all my associates, as if like to read it next my links
will too.

I've been browsing online

I've been browsing online greater than three hours lately, yet I by no means discovered any attention-grabbing article
like yours. It's beautiful worth enough for me. In my view, if all site
owners and bloggers made good content as you probably did,
the web will probably be a lot more useful than ever before.

I'm extremely impressed along

I'm extremely impressed along with your writing skills as neatly as with the structure on your blog.
Is this a paid subject or did you modify it yourself? Anyway keep up the nice high quality writing,
it is rare to peer a great weblog like this one these days..

I do not even know the way I

I do not even know the way I finished up right here, however I thought this submit used to be great.
I don't recognise who you're but definitely you are
going to a famous blogger if you aren't already. Cheers!

I need to to thank you for

I need to to thank you for this very good read!!

I certainly enjoyed every bit of it. I've got
you bookmarked to check out new stuff you post…

We stumbled over here by a

We stumbled over here by a different web address and thought
I should check things out. I like what I see so i am just following you.
Look forward to finding out about your web page again.

Hello would you mind stating

Hello would you mind stating which blog platform you're
using? I'm looking to start my own blog soon but I'm having a tough
time deciding between BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your layout seems different then most blogs and I'm looking for something unique.
P.S Apologies for getting off-topic but I
had to ask!

Hey there! I know this is

Hey there! I know this is kinda off topic nevertheless I'd figured I'd ask.
Would you be interested in exchanging links or maybe guest authoring a blog post or vice-versa?

My blog discusses a lot of the same subjects as yours and I believe we could greatly benefit from each other.

If you're interested feel free to shoot me an email. I look forward to hearing from you!
Fantastic blog by the way!

This design is steller! You

This design is steller! You definitely know how to keep a reader entertained.

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!

I got this web site from my

I got this web site from my pal who shared with me regarding this website and at the moment this
time I am visiting this web site and reading very informative content at this
time.

great website

great website

I visited various sites but

I visited various sites but the audio quality for audio songs current at this web site is truly superb.

I every time used to read

I every time used to read paragraph in news papers but now as I am a user of web thus from
now I am using net for posts, thanks to web.

It's hard to come by

It's hard to come by well-informed people on this topic, however, you sound like you know what
you're talking about! Thanks

It's a shame you don't have a

It's a shame you don't have a donate button! I'd without a doubt donate to this outstanding blog!
I suppose for now i'll settle for book-marking
and adding your RSS feed to my Google account. I look forward to fresh updates and will share this
site with my Facebook group. Talk soon!

What a information of

What a information of un-ambiguity and preserveness of valuable experience about unpredicted emotions.

What's up, I want to

What's up, I want to subscribe for this webpage to take most recent updates,
therefore where can i do it please help.

I think the admin of this web

I think the admin of this web page is in fact working hard in favor of his website, for the reason that here every stuff is quality based stuff.

Its such as you learn my

Its such as you learn my thoughts! You appear to understand so
much approximately this, like you wrote the ebook
in it or something. I think that you could do with some % to drive the message home a bit, but other than that, that is wonderful blog.
A fantastic read. I will certainly be back.

This page really has all the

This page really has all the info I needed concerning this subject and didn't know who to
ask.

Very good post. I will be

Very good post. I will be facing some of these issues as well..

Hey there! I'm at work

Hey there! I'm at work browsing your blog from my new apple iphone!
Just wanted to say I love reading your blog and look forward to all
your posts! Keep up the superb work!

I have been exploring for a

I have been exploring for a little for any high-quality articles or blog posts in this sort of area .
Exploring in Yahoo I finally stumbled upon this web site.
Studying this info So i'm satisfied to convey that I've a
very excellent uncanny feeling I came upon exactly what I needed.
I most surely will make certain to do not fail to remember
this web site and provides it a glance on a constant basis.

Wow that was unusual. I just

Wow that was unusual. I just wrote an incredibly long comment but after I clicked
submit my comment didn't appear. Grrrr... well I'm not writing
all that over again. Anyhow, just wanted to say excellent blog!

Aw, this was an incredibly

Aw, this was an incredibly good post. Taking the time and actual
effort to create a great article… but what can I say… I put things off
a whole lot and don't seem to get anything done.

Greetings from Los angeles!

Greetings from Los angeles! I'm bored to death at work so I decided to check out your website on my iphone during lunch break.
I enjoy the knowledge you present here and can't wait
to take a look when I get home. I'm amazed at how fast your
blog loaded on my cell phone .. I'm not even using WIFI, just 3G
.. Anyways, fantastic blog!

Hey! Do you know if they make

Hey! Do you know if they make any plugins to safeguard against hackers?
I'm kinda paranoid about losing everything I've worked hard on. Any tips?

Hey there would you mind

Hey there would you mind letting me know which hosting company you're utilizing?
I've loaded your blog in 3 completely different internet browsers and
I must say this blog loads a lot faster then most. Can you recommend a good internet hosting provider at a fair price?

Cheers, I appreciate it!

Hi there, this weekend is

Hi there, this weekend is pleasant for me, as this time i am reading this impressive informative paragraph here at
my house.

Oh my goodness! Incredible

Oh my goodness! Incredible article dude! Many thanks, However I am having troubles with your RSS.

I don't know why I can't subscribe to it. Is there anyone else having
identical RSS problems? Anybody who knows the answer can you kindly respond?
Thanx!!

I couldn't resist commenting.

I couldn't resist commenting. Very well written!

Hiya! I know this is kinda

Hiya! I know this is kinda off topic however , I'd figured I'd
ask. Would you be interested in exchanging links or maybe guest
authoring a blog post or vice-versa? My website addresses a lot of the
same subjects as yours and I feel we could greatly benefit from
each other. If you're interested feel free to shoot me an e-mail.
I look forward to hearing from you! Fantastic blog by the way!

Hi there, I enjoy reading

Hi there, I enjoy reading through your article. I wanted to write a little comment to
support you.

Its like you read my mind!

Its like you read my mind! You seem to grasp a lot about this, such as you
wrote the e book in it or something. I feel that you simply can do with a few p.c.
to drive the message home a little bit, however instead of that, that is excellent
blog. An excellent read. I'll certainly be back.

Every weekend i used to visit

Every weekend i used to visit this web site, because i wish for enjoyment,
since this this web page conations in fact fastidious funny material too.

Wonderful blog! I found it

Wonderful blog! I found it while surfing around on Yahoo News.

Do you have any tips on how to get listed in Yahoo News?

I've been trying for a while but I never seem to get there!
Thank you

I love what you guys are up

I love what you guys are up too. This kind of clever work and exposure!
Keep up the wonderful works guys I've added you guys
to my own blogroll.

Hi to every body, it's my

Hi to every body, it's my first visit of this weblog;
this weblog carries awesome and in fact fine material in favor of readers.

It's awesome in favor of me

It's awesome in favor of me to have a site, which is beneficial
in favor of my knowledge. thanks admin

Thank you for the auspicious

Thank you for the auspicious writeup. It actually was once a
enjoyment account it. Glance complicated to far delivered agreeable from you!
However, how could we keep in touch?

This is a really good tip

This is a really good tip particularly to those fresh to
the blogosphere. Simple but very accurate info… Thank you for sharing this
one. A must read post!

It's a pity you don't have a

It's a pity you don't have a donate button! I'd most certainly donate to this superb blog!

I guess for now i'll settle for bookmarking and adding your RSS feed to my Google account.

I look forward to new updates and will share this site with my Facebook group.
Talk soon!

Thanks in favor of sharing

Thanks in favor of sharing such a good opinion, piece of writing is
pleasant, thats why i have read it completely

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.