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.
Kategória: 
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ó.

Hozzászólások

A fascinating discussion is

A fascinating discussion is worth comment. I believe that you
ought to publish more on this issue, it may not be a taboo matter but
typically people don't discuss these topics.
To the next! Cheers!!

Excellent weblog right here!

Excellent weblog right here! Also your website a lot up very fast!
What web host are you the use of? Can I get your affiliate link for your
host? I want my web site loaded up as fast as yours lol

Everyone loves what you guys

Everyone loves what you guys are usually up too. This sort of clever
work and reporting! Keep up the terrific works
guys I've added you guys to my personal blogroll.

Hi there Dear, are you really

Hi there Dear, are you really visiting this web
site regularly, if so then you will definitely take pleasant know-how.

Magnificent goods from you,

Magnificent goods from you, man. I've take into account your stuff prior
to and you are simply too magnificent. I really like what you've acquired right here, certainly like what you're stating and
the best way wherein you assert it. You make it
entertaining and you continue to take care of to stay it sensible.
I can not wait to read far more from you. This is
really a great site.

Appreciation to my father who

Appreciation to my father who told me on the topic of this weblog, this webpage
is actually remarkable.

Does your website have a

Does your website have a contact page? I'm having trouble locating it but,
I'd like to shoot you an email. I've got some ideas for your blog you might be interested
in hearing. Either way, great site and I look forward to seeing it expand over time.

Wow because this is very

Wow because this is very great job! Congrats and keep it up. sites:ggglese.com
fotbollströjor

I like the valuable info you

I like the valuable info you provide in your articles.
I'll bookmark your blog and check again here frequently.
I am quite sure I'll learn a lot of new stuff right here!
Best of luck for the next!

Hello! This is my first

Hello! This is my first comment here so I just wanted to give a quick shout
out and say I genuinely enjoy reading your blog posts.
Can you recommend any other blogs/websites/forums that deal with the same topics?

Thanks for your time!

A financial advisor is your

A financial advisor is your planning partner.

These are really wonderful

These are really wonderful ideas in regarding blogging.
You have touched some good things here. Any way keep up wrinting.

Investors do pay direct and

Investors do pay direct and oblique prices.

propecia online pharmacy

propecia online pharmacy generic cialis canada pharmacy dosage of fluconazole in dogs itraconazole ou fluconazole online pharmacy pharmacy prednisone buy prednisone clomid clomid ovipura

excellent publish, very

excellent publish, very informative. I'm wondering why the other experts of this sector don't realize this.
You should continue your writing. I'm sure, you've a huge readers' base
already!

synthroid benefits of

synthroid benefits of synthroid cialis 20mg price cialis generic flagyl flagyl buy levitra online levitra buy lasix without prescription lasix to buy online no prescription cialis 20 mg price cialis 20mg price eboqfeqiw

Heya i'm for the primary time

Heya i'm for the primary time here. I came across this board and I
in finding It really useful & it helped me out a lot.
I hope to give something again and help others like you aided me.

It's going to be end of mine

It's going to be end of mine day, except before ending I am reading this great paragraph to increase my knowledge.

All varieties of investments

All varieties of investments come with sure risks.

A fascinating discussion is

A fascinating discussion is definitely worth comment.

I believe that you ought to write more on this issue, it might not
be a taboo matter but usually people do not talk about these issues.
To the next! Many thanks!!

Hi there, I enjoy reading all

Hi there, I enjoy reading all of your article post.
I like to write a little comment to support you.

A financial advisor is your

A financial advisor is your planning accomplice.

It's amazing to visit this

It's amazing to visit this website and reading the views of all friends about this paragraph, while I
am also keen of getting knowledge.

I’m not that much of a

I’m not that much of a internet reader to be honest but your sites really nice,
keep it up! I'll go ahead and bookmark your site to come back down the road.
Many thanks

Thanks for your interest in

Thanks for your interest in Investment Advice.

Thank you on your interest in

Thank you on your interest in Investment Recommendation.

I'm amazed, I have to admit.

I'm amazed, I have to admit. Rarely do I come across a
blog that's both equally educative and amusing, and without a
doubt, you've hit the nail on the head. The issue is something that not enough folks are speaking intelligently about.
Now i'm very happy that I found this in my search for
something concerning this.

Saved as a favorite, I really

Saved as a favorite, I really like your website!

canadian pharmacy online

canadian pharmacy online propecia pharmacy nexium 40 mg nexium levitra 20mg levitra generic levitra generic levitra diflucan diflucan without prescription generic levitra levitra azezihew

I am sure this article has

I am sure this article has touched all the internet people, its
really really pleasant post on building up new blog.

My relatives always say that

My relatives always say that I am killing my time here at
net, except I know I am getting knowledge everyday by reading such good articles.

Awesome! Its really

Awesome! Its really remarkable post, I have got much clear idea on the topic of from this piece of writing.

buy lasix online lasix retin

buy lasix online lasix retin a micro buy retin a online online propecia propecia online nexium 40mg esomeprazole generic nexium levitra generic levitra.com buy priligy uk priligy buy online salbutamol inhaler buy online ventolin idemagoka

Link exchange is nothing else

Link exchange is nothing else but it is only placing the other person's weblog link
on your page at appropriate place and other person will also do same in favor of you.

Schwab Clever Portfolios

Schwab Clever Portfolios invests in Schwab ETFs.

Hurrah, that's what I was

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

A monetary advisor is your

A monetary advisor is your planning accomplice.

you're really a good

you're really a good webmaster. The web site loading
speed is incredible. It kind of feels that you're doing any distinctive
trick. Also, The contents are masterpiece. you have performed a excellent activity in this topic!

All forms of investments

All forms of investments include certain risks.

Now it's time to decide your

Now it's time to decide your particular investments.

I will immediately grab your

I will immediately grab your rss as I can't in finding your email subscription hyperlink or newsletter service.
Do you have any? Please let me understand in order that
I may subscribe. Thanks.

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 needed to get setup? I'm assuming having a blog like
yours would cost a pretty penny? I'm not very internet smart so I'm not 100%
certain. Any recommendations or advice would be greatly
appreciated. Kudos

Schwab Clever Portfolios

Schwab Clever Portfolios invests in Schwab ETFs.

It's truly very complex in

It's truly very complex in this busy life to listen news on Television, so I only use internet for
that purpose, and obtain the hottest information.

Consider investments that

Consider investments that supply speedy annuities.

tadalafil tadalafil levitra

tadalafil tadalafil levitra online vardenafil generic lowest price on generic cialis cialis lowest price prednisone no prescription prednisone amoxicillin amoxicillin without prescription pharmacy propecia pharmacy ofihfoha

You've made some really good

You've made some really good points there. I looked on the
web to learn more about the issue and found most individuals will
go along with your views on this site.

Greetings! Very helpful

Greetings! Very helpful advice within this post!

It is the little changes that produce the most significant changes.
Many thanks for sharing!

Thanks for every other

Thanks for every other informative website. Where else could I am getting that
kind of information written in such a perfect way?
I have a undertaking that I'm simply now operating on, and I've been on the look out for such information.

cialis cialis 10 mg nolvadex

cialis cialis 10 mg nolvadex online nolvadex online propecia on line no prescription propecia cialis without a prescription cialis cialis dosage 20mg cialis dosage 20mg emcofos

Hozzászólás

A mező tartalma nem nyilvános.
  • Internal paths in double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or relative path.
  • Engedélyezett HTML elemek: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <del> <img>
  • A webcímek és email címek automatikusan linkekké alakulnak.
  • A sorokat és bekezdéseket a rendszer automatikusan felismeri.
  • Engedélyezett HTML elemek: <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].
  • Minden email cím át lesz alakítva ember által olvasható módon, vagy (ha a JavaScript engedélyezett) ki lesz cserélve kattintható, de biztonságos hivatkozásra.