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

If you are going for most

If you are going for most excellent contents like myself, just
pay a quick visit this web page everyday since it gives feature contents, thanks

Greetings from Los angeles!

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

I am really impressed with

I am really impressed with your writing skills
as well as with the layout on your weblog. Is this a paid theme or did you modify
it yourself? Anyway keep up the nice quality writing,
it is rare to see a nice blog like this one nowadays.

I always spent my half an

I always spent my half an hour to read this blog's content every day along with a
cup of coffee.

I don't know if it's just me

I don't know if it's just me or if everyone else experiencing issues with your blog.
It appears like some of the written text on your content are running
off the screen. Can someone else please provide feedback
and let me know if this is happening to them too? This could be a issue with my browser because I've had this happen before.
Thank you

Neat blog! Is your theme

Neat blog! Is your theme custom made or did you
download it from somewhere? A design like yours with a few simple tweeks would really make my blog shine.
Please let me know where you got your design. Thank you

It's a shame you don't have a

It's a shame you don't have a donate button! I'd most certainly donate
to this superb blog! I guess 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 blog with my Facebook group.

Chat soon!

Simply wish to say your

Simply wish to say your article is as amazing.

The clearness to your put up is simply cool and i can assume you're an expert in this subject.

Fine along with your permission let me to snatch your RSS
feed to stay updated with drawing close post. Thanks a million and
please keep up the rewarding work.

Excellent weblog right here!

Excellent weblog right here! Additionally your website quite a bit up fast! What host are you using? Can I am getting your affiliate hyperlink on your host? I desire my web site loaded up as fast as yours lol|

Hi there I am so thrilled I

Hi there I am so thrilled I found your webpage, I really found you by mistake,
while I was browsing on Askjeeve for something else, Nonetheless I am here
now and would just like to say thanks a lot for
a tremendous post and a all round interesting blog (I also love the theme/design), I
don’t have time to read it all at the moment but I have book-marked
it and also included your RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the awesome jo.

It's remarkable to go to see

It's remarkable to go to see this web page
and reading the views of all colleagues concerning this post, while
I am also zealous of getting knowledge.

Hi there! Quick question

Hi there! Quick question that's completely off topic.
Do you know how to make your site mobile friendly?
My site looks weird when browsing from my iphone. I'm trying to
find a template or plugin that might be able to fix this problem.
If you have any recommendations, please share. Thank you!

My brother suggested I may

My brother suggested I may like this website.
He was entirely right. This put up actually made my day. You can not consider
simply how much time I had spent for this information! Thank you!

Inspiring quest there. What

Inspiring quest there. What happened after? Take care!

Very nice post. I simply

Very nice post. I simply stumbled upon your blog and wanted to say that I've
really loved browsing your weblog posts. After all
I'll be subscribing for your feed and I hope you write once more soon!

Do you have a spam issue on

Do you have a spam issue on this site; I also am a blogger,
and I was wondering your situation; many of us
have developed some nice procedures and we are looking to swap methods with other folks, please shoot me an e-mail if interested.

I got this site from my pal

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

I love your blog.. very nice

I love your blog.. very nice colors & theme.

Did you design this website yourself or did you hire
someone to do it for you? Plz respond as I'm looking to construct my own blog and would like to
know where u got this from. thanks a lot

Thanks in support of sharing

Thanks in support of sharing such a nice idea, paragraph is pleasant,
thats why i have read it completely

Hi there! I could have sworn

Hi there! I could have sworn I've visited this blog before but after browsing through many of the posts I realized it's new to me. Anyhow, I'm definitely happy I discovered it and I'll be book-marking it and checking back often!|

What's up it's me, I am also

What's up it's me, I am also visiting this website daily, this web site is
truly pleasant and the visitors are actually sharing nice thoughts.

I know this if off topic but

I know this if off topic but I'm looking into starting my own weblog and was curious what all
is required to get set up? I'm assuming having a
blog like yours would cost a pretty penny? I'm not very internet smart so I'm not 100% sure.
Any tips or advice would be greatly appreciated.

Appreciate it

Thank you for every other

Thank you for every other great article. The place else
may just anybody get that kind of info in such a perfect
means of writing? I have a presentation subsequent
week, and I am on the search for such info.

Great information. Lucky me I

Great information. Lucky me I discovered your site by chance (stumbleupon).

I have book-marked it for later!

Excellent post. I was

Excellent post. I was checking constantly this blog and I am impressed!

Extremely helpful info specially the last part :) I care for
such info much. I was seeking this particular information for a long time.
Thank you and good luck.

Howdy! Quick question that's

Howdy! Quick question that's totally off topic. Do you know how to make your site mobile friendly?
My weblog looks weird when viewing from my iphone.
I'm trying to find a template or plugin that might be able to fix this problem.
If you have any suggestions, please share. Cheers!

Hurrah, that's what I was

Hurrah, that's what I was seeking for, what a stuff!
present here at this weblog, thanks admin of this
web page.

It's amazing in favor of me

It's amazing in favor of me to have a website, which is good in support of
my knowledge. thanks admin

I am regular visitor, how are

I am regular visitor, how are you everybody? This paragraph posted at this
web site is truly fastidious.

Actually no matter if someone

Actually no matter if someone doesn't know afterward its up to other visitors that they
will assist, so here it takes place.

Wow that was unusual. I just

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

Greetings! Very helpful

Greetings! Very helpful advice within this article! It is the little changes that will make the largest changes.
Many thanks for sharing!

I like reading through a post

I like reading through a post that can make people think.
Also, thank you for allowing me to comment!

Wow, this article is

Wow, this article is fastidious, my younger sister
is analyzing such things, so I am going to tell her.

Link exchange is nothing else

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

This is very interesting, You

This is very interesting, You are a very skilled blogger.

I've joined your feed and look forward to
seeking more of your excellent post. Also, I have shared your
site in my social networks!

Thanks for your personal

Thanks for your personal marvelous posting!
I seriously enjoyed reading it, you might be a great author.I
will ensure that I bookmark your blog and may
come back someday. I want to encourage you to ultimately
continue your great job, have a nice evening!

Very shortly this website

Very shortly this website will be famous among all blogging viewers, due to it's pleasant posts

You could certainly see your

You could certainly see your expertise within the work you write.
The sector hopes for even more passionate writers like you
who are not afraid to say how they believe.
All the time follow your heart.

You're so awesome! I don't

You're so awesome! I don't suppose I've read through a single thing like this before.
So good to discover someone with original thoughts on this topic.
Seriously.. thank you for starting this up. This web site
is something that's needed on the internet, someone with some originality!

Because the admin of this web

Because the admin of this web site is working, no hesitation very
shortly it will be famous, due to its quality contents.

Great post. I was checking

Great post. I was checking constantly this weblog and I am impressed!
Very useful info particularly the final phase :) I care for such info a lot.
I used to be seeking this certain info for a very lengthy time.
Thanks and best of luck.

I do believe all the ideas

I do believe all the ideas you've introduced for your post. They're really convincing and will certainly work. Nonetheless, the posts are too quick for starters. May you please extend them a little from subsequent time? Thanks for the post.|

Great article, just what I

Great article, just what I was looking for.

I all the time emailed this

I all the time emailed this blog post page to all my contacts, for the reason that if like to read it next my contacts will too.

Hi! This post could not be

Hi! This post could not be written any better!
Reading through this post reminds me of my old room mate!
He always kept talking about this. I will forward this page to
him. Fairly certain he will have a good read.
Thank you for sharing!

Oh my goodness! Incredible

Oh my goodness! Incredible article dude! Thanks, However I am encountering difficulties with your RSS.
I don't know why I cannot subscribe to it. Is there anybody else
having identical RSS problems? Anyone who knows the solution will you kindly respond?
Thanks!!

I was recommended this web

I was recommended this web site by my cousin. I'm not sure whether this post is written by him as no one else know such detailed about my trouble.
You're wonderful! Thanks!

Valuable information. Lucky

Valuable information. Lucky me I discovered your web site unintentionally, and I'm shocked
why this accident didn't came about earlier! I bookmarked it.

I quite like looking through

I quite like looking through a post that will make people think.
Also, thank you for allowing for me to comment!

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.