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

Schwab Intelligent Portfolios

Schwab Intelligent Portfolios invests in Schwab ETFs.

Hello, Neat post. There is an

Hello, Neat post. There is an issue along with your web site in web
explorer, could test this? IE nonetheless is the marketplace chief and a big component
to people will miss your great writing because of this problem.

Great beat ! I wish to

Great beat ! I wish to apprentice while you amend your site, how could
i subscribe for a blog site? The account aided me
a acceptable deal. I had been a little bit acquainted of this your broadcast
provided bright clear idea

Traders do pay direct and

Traders do pay direct and oblique costs.

great submit, very

great submit, very informative. I wonder why the opposite experts of this sector do
not notice this. You must continue your writing. I'm sure, you've a great readers' base already!

generic cialis 20mg cialis

generic cialis 20mg cialis online buy cialis canadian cialis celebrex generic celebrex no prescription retin a micro retin a cream 0.05 buy lasix on line lasix no prescription buy doxycycline buy doxycycline buy cialis online buy cialis online cialis for sale cialis oexurucn

A monetary advisor is your

A monetary advisor is your planning associate.

nexium nexium generic cialis

nexium nexium generic cialis canadian pharmacy cialis 20mg generic levitra 20mg levitra generic pharmacy canada pharmacy online no script prednisone 20 mg prednisone 20 mg esivali

My brother recommended I

My brother recommended I might like this web site.
He was entirely right. This post truly made my day.
You cann't imagine just how much time I had spent for this
information! Thanks!

And that is an investment

And that is an investment threat worth taking.

If some one wants expert view

If some one wants expert view regarding running a blog
after that i advise him/her to go to see this web
site, Keep up the fastidious job.

Generally I don't learn

Generally I don't learn article on blogs, however I wish to say that this write-up
very forced me to check out and do so! Your writing style has been surprised me.
Thank you, very great post.

Monetary advisors business is

Monetary advisors business is people enterprise.

metronidazole 500mg

metronidazole 500mg antibiotic metronidazole 500 mg prednisone 20mg prednisone without prescription.net buying cialis online cialis online cialis cost cialis 5 mg buy furosemide online buy furosemide online ooxoxinaz

A monetary advisor is your

A monetary advisor is your planning accomplice.

Hello there! This is my 1st

Hello there! This is my 1st 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
subjects? Thanks a lot!

pharmacy cialis canadian

pharmacy cialis canadian pharmacy levitra buy levitra online cialis eli lilly cialis cialis 5mg cialis 5mg buy prednisone without a perscription online prednisone with no prescription generic levitra 20mg levitra prices order doxycycline 100mg order doxycycline 100mg enawodufu

Someone necessarily lend a

Someone necessarily lend a hand to make seriously posts I would state.
That is the first time I frequented your website page and to this point?
I surprised with the research you made to make this particular post amazing.
Wonderful task!

What's up i am kavin, its my

What's up i am kavin, its my first time to commenting anywhere, when i
read this post i thought i could also make comment due to this brilliant article.

I like the valuable

I like the valuable information you provide on your articles.
I'll bookmark your weblog and take a look at again here frequently.
I'm moderately sure I'll learn a lot of new stuff right right here!

Good luck for the next!

It's amazing to visit this

It's amazing to visit this site and reading the views of all mates on the topic of this paragraph, while I
am also zealous of getting experience.

Monetary advisors business is

Monetary advisors business is people business.

This is true for funding

This is true for funding advice as nicely.

nolvadex for sale nolvadex

nolvadex for sale nolvadex canada cialis www.cialis.com cialis cialis buy zoloft online zoloft amplified sounds vardenafil 20mg levitra 20mg xunixid

Hey would you mind stating

Hey would you mind stating which blog platform you're using?
I'm planning to start my own blog in the near future but I'm having
a difficult time making a decision between BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your design and style seems different then most
blogs and I'm looking for something completely unique.
P.S Apologies for getting off-topic but I had to ask!

generic cialis lowest price

generic cialis lowest price generic cialis generic propecia propecia buy cialis online generic cialis lowest price prednisone without dr prescription prednisone prescription cialis online generic tadalafil 20mg cialis cialis buy zithromax online zithromax on line cialis tadalafil 20mg lowest price canada pharmacy canadian pharmacy online oiepoce

I all the time used to study

I all the time used to study paragraph in news papers but
now as I am a user of net so from now I am using net for content, thanks to
web.

Very nice article, totally

Very nice article, totally what I needed.

buy prednisone buy prednisone

buy prednisone buy prednisone amoxicillin 500 amoxicillin 500mg capsules levitra buy levitra prednisone online www.prednisone levitra online vardenafil 20mg buy doxycycline 100mg buy doxycycline online a href uuruaxos

Hmm it looks like your

Hmm it looks like your website ate my first comment (it was super long) so I guess I'll just sum it up what I wrote and say, I'm
thoroughly enjoying your blog. I as well am an aspiring
blog blogger but I'm still new to everything. Do you have any tips and hints for newbie blog writers?
I'd really appreciate it.

cialis tablets cialis 20mg

cialis tablets cialis 20mg price cialis generic canada cialis 20mg buying levitra online levitra 20 mg online where to buy misoprostol online where to buy misoprostol nexium 40mg esomeprazole nexium coupons canadian cialis tadalafil 20 mg cialis dosage cialis tadalafil buying levitra pharmacy prices for levitra esoaiz

whoah this weblog is

whoah this weblog is excellent i like reading your posts.

Keep up the good work! You realize, many people are hunting round for this info, you can aid them greatly.

c3phbnRvZ2Fib3IuY29t

Consider investments that

Consider investments that provide fast annuities.

This is true for investment

This is true for investment recommendation as nicely.

I am sure this article has

I am sure this article has touched all the internet users,
its really really fastidious post on building up new webpage.

Good day! Do you know if they

Good day! Do you know if they make any plugins to
protect against hackers? I'm kinda paranoid about
losing everything I've worked hard on. Any suggestions?

I'm truly enjoying the design

I'm truly enjoying the design and layout of your site.
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 designer to create your theme?

Excellent work!

propecia how to get propecia

propecia how to get propecia levitra generic levitra generic levitra levitra 20 cialis price tadalafil tablets 20 mg levitra online levitra 20 mg levitra 20mg levitra 20mg aneyawon

Monetary advisors business is

Monetary advisors business is folks business.

I know this if off topic but

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

This is true for funding

This is true for funding recommendation as nicely.

naturally like your website

naturally like your website but you need to test the spelling on several of your
posts. Many of them are rife with spelling problems and
I in finding it very troublesome to tell the reality on the other hand I will definitely
come again again.

Woah! I'm really digging the

Woah! I'm really digging the template/theme of this website.
It's simple, yet effective. A lot of times it's tough to
get that "perfect balance" between usability and visual appearance.
I must say you have done a fantastic job
with this. Also, the blog loads super quick
for me on Internet explorer. Exceptional Blog!

Hello there, I discovered

Hello there, I discovered your blog by the use of Google whilst searching for a comparable matter,
your web site came up, it seems to be good.
I've bookmarked it in my google bookmarks.
Hi there, simply changed into alert to your weblog through Google, and
located that it is really informative. I am going
to be careful for brussels. I'll be grateful for those who proceed this in future.
Many other folks shall be benefited from your writing.
Cheers!

Do you know what the most

Do you know what the most popular Halloween costumes are for
2018? Check out http://destyy.com/wZ21KY and see what they are.

You’re really going to be surprised by number nine.
It’s definitely one you’re not going to forget any time soon.

Greetings! Very useful advice

Greetings! Very useful advice in this particular post!
It's the little changes which will make the most important changes.
Thanks for sharing!

Ahaa, its fastidious

Ahaa, its fastidious discussion on the topic of this post here at this web
site, I have read all that, so now me also commenting
here.

What a stuff of un-ambiguity

What a stuff of un-ambiguity and preserveness of
precious know-how about unexpected feelings.

c3phbnRvZ2Fib3IuY29t

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.