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

How would you like to get

How would you like to get paid to test apps?

You can and it’s super simple. Just visit http://bit.ly/2FfjVJi and follow the directions.
You’ll be getting paid to test apps in a matter of no time.

I have read so many articles

I have read so many articles on the topic of the blogger lovers but this
article is truly a fastidious post, keep it up.

Great info. Lucky me I came

Great info. Lucky me I came across your blog by chance (stumbleupon).
I have saved as a favorite for later!

Hi! Someone in my Facebook

Hi! Someone in my Facebook group shared this website with
us so I came to give it a look. I'm definitely
loving the information. I'm book-marking and will be tweeting this to my followers!
Terrific blog and great style and design.

Spot on with this write-up, I

Spot on with this write-up, I truly believe this website
needs a lot more attention. I'll probably be returning to read more,
thanks for the information!

Hi there! I know this is

Hi there! I know this is somewhat off topic but I
was wondering which blog platform are you using for
this site? I'm getting fed up of Wordpress because I've had
issues with hackers and I'm looking at options for another
platform. I would be great if you could point me in the direction of a good
platform.

Hey there, I think your site

Hey there, I think your site might be having browser compatibility issues.
When I look at your blog in Safari, it looks fine but when opening in Internet Explorer,
it has some overlapping. I just wanted to give you
a quick heads up! Other then that, terrific blog!

I think this is among the

I think this is among the most significant info for
me. And i'm glad reading your article. But wanna remark on few general things, The website style is great, the articles is really
nice : D. Good job, cheers

I like what you guys tend to

I like what you guys tend to be up too. This type of clever work and reporting!
Keep up the fantastic works guys I've included you guys to my
personal blogroll.

Excellent post. I'm

Excellent post. I'm experiencing a few of these issues as well..

Great post.

Great post.

I couldn't refrain from

I couldn't refrain from commenting. Well written!

buy cialis online canada

buy cialis online canada cialis 10 mg flagyl 500 mg flagyl 500 mg doxycycline doxycycline monohydrate 100mg canadian pharmacy online on line pharmacy retin a buy retin a cream vardenafil 20 mg generic levitra vardenafil pharmacy cialis canadian pharmacy axayape

nexium 40mg nexium price

nexium 40mg nexium price generic cialis canada pharmacy canadian pharmacy cialis cialis generic canada generic tadalafil tadalafil walmart cialis on line prednisone prednisone 10 mg oqigebni

Hello, i think that i saw you

Hello, i think that i saw you visited my weblog so i came to “return the favor”.I am trying to find things to enhance my site!I suppose its ok to use
a few of your ideas!!

Hurrah! At last I got a

Hurrah! At last I got a website from where I can genuinely take
valuable facts regarding my study and knowledge.

I'm gone to inform my little

I'm gone to inform my little brother, that
he should also go to see this web site on regular basis to get updated from latest
reports.

Consider investments that

Consider investments that supply fast annuities.

Howdy I am so glad I found

Howdy I am so glad I found your blog, I really found you by mistake,
while I was browsing on Bing for something else, Regardless I
am here now and would just like to say thanks a lot for a fantastic post and a all
round thrilling blog (I also love the theme/design), I don't have
time to browse it all at the moment but I have saved it and also included your RSS feeds, so when I have time I will be back to read
much more, Please do keep up the fantastic job.

Unquestionably consider that

Unquestionably consider that which you said.

Your favourite reason seemed to be on the internet
the easiest thing to keep in mind of. I say to you, I certainly get annoyed at the same time as other folks consider concerns that they just don't realize about.
You controlled to hit the nail upon the top as smartly as defined out the entire thing
without having side effect , other folks could take a signal.
Will probably be again to get more. Thank you

Thanks for your curiosity in

Thanks for your curiosity in Investment Recommendation.

Hello, i read your blog from

Hello, i read your blog from time to time and i own a similar one and i was just curious if you get a lot of
spam remarks? If so how do you reduce it, any plugin or anything you can recommend?
I get so much lately it's driving me insane so any support is very much appreciated.

This is true for funding

This is true for funding recommendation as nicely.

A financial advisor is your

A financial advisor is your planning partner.

Buyers do pay direct and

Buyers do pay direct and oblique prices.

buy thyroxine how to begin

buy thyroxine how to begin synthroid therapy buy doxycycline online doxycycline 100mg metronidazole 500mg antibiotic flagyl 500mg antibiotic propecia pills propecia without a prescription cialis on line cialis generic 20 mg levitra 20 mg prices generic levitra kamagra oral jelly kamagra taking zithromax with 0ne kidney buy azithromycin retin a micro buy retin-a opogen

Hi there to every body, it's

Hi there to every body, it's my first visit of this webpage; this web site includes remarkable and actually fine material designed for
visitors.

Take into account investments

Take into account investments that offer speedy annuities.

This is true for investment

This is true for investment advice as nicely.

Quality content is the main

Quality content is the main to be a focus for the users to visit the web site, that's what this web
page is providing.

What's up, I check your blogs

What's up, I check your blogs regularly. Your humoristic style is witty, keep up the good
work!

May I simply just say what a

May I simply just say what a relief to discover an individual
who really knows what they are discussing online. You certainly know how to bring a problem to light
and make it important. A lot more people really need to check this out
and understand this side of the story. I was surprised you aren't more popular since you definitely have the gift.

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 fantastic blog!

I suppose for now i'll settle for book-marking and adding your RSS feed to my Google account.

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

I just like the valuable

I just like the valuable information you provide for your articles.
I will bookmark your blog and take a look at once more here frequently.
I am slightly certain I will be informed plenty
of new stuff right right here! Good luck for the next!

I must thank you for the

I must thank you for the efforts you've put
in writing this site. I am hoping to check out the same high-grade blog posts from you
in the future as well. In truth, your creative writing abilities has inspired me to get my own, personal website
now ;)

I blog frequently and I

I blog frequently and I genuinely thank you for your information. This article has truly peaked my interest.
I am going to bookmark your site and keep checking for new information about once a week.

I subscribed to your RSS feed as well.

After looking over a few of

After looking over a few of the blog posts on your web site, I seriously like your technique of blogging.
I saved it to my bookmark site list and will be checking back soon. Please check
out my web site as well and tell me how you feel.

I have read so many content

I have read so many content concerning the blogger lovers except this piece of writing is truly
a fastidious paragraph, keep it up.

I'm not sure where you're

I'm not sure where you're getting your information, but
good topic. I needs to spend some time learning much more or understanding
more. Thanks for excellent info I was looking for this information for my mission.

online pharmacy pharmacy

online pharmacy pharmacy cialis canada pharmacy online canadapharmacy.com levitra vardenafil dosage canadian pharmacy online pharmacy buy cipro online ciprofloxacin 500mg urvekouyi

Now it's time to decide your

Now it's time to decide your specific investments.

Thanks for your marvelous

Thanks for your marvelous posting! I genuinely enjoyed reading it,
you will be a great author. I will always bookmark your blog and
definitely will come back someday. I want to encourage that you continue your great work, have a nice afternoon!

cialis online pharmacy cialis

cialis online pharmacy cialis online pharmacy cialis originale on line cialis sky pharmacy sky pharmacy buy cytotec online buy cytotec tadalafil buy cialis online izboxumem

I take pleasure in, result in

I take pleasure in, result in I found exactly what I was looking for.
You've ended my four day long hunt! God Bless you man. Have a nice day.
Bye

Thank you to your interest in

Thank you to your interest in Funding Recommendation.

I am really thankful to the

I am really thankful to the holder of this site who has shared this fantastic paragraph at here.

Great site you've got here..

Great site you've got here.. It's difficult to find good quality writing like yours these days.

I honestly appreciate individuals like you! Take care!!

I'm really enjoying the

I'm really enjoying the design and layout of your blog. It's a very easy on the eyes which makes
it much more enjoyable for me to come here and visit more often. Did
you hire out a developer to create your theme? Superb work!

c3phbnRvZ2Fib3IuY29t

Nice replies in return of

Nice replies in return of this matter with genuine arguments
and explaining all regarding that.

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.