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

It's an remarkable post

It's an remarkable post designed for all the online people; they will get benefit from
it I am sure.

Hi there mates, its fantastic

Hi there mates, its fantastic post on the topic of
tutoringand completely explained, keep it up all the time.

Definitely consider that

Definitely consider that which you stated. Your favorite justification seemed to
be at the net the easiest thing to remember of. I say to you, I certainly get irked whilst people consider concerns that they plainly don't know about.
You managed to hit the nail upon the top and also defined out the entire thing without having
side effect , folks can take a signal. Will likely be back to get more.
Thanks

Do you have a spam problem on

Do you have a spam problem on this blog; I also am a blogger,
and I was wondering your situation; many of
us have developed some nice methods and we are looking to exchange solutions with other
folks, please shoot me an email if interested.

Hey there would you mind

Hey there would you mind letting me know which webhost you're
utilizing? I've loaded your blog in 3 completely different browsers and I must say this blog loads a lot quicker then most.

Can you recommend a good internet hosting provider at a reasonable price?
Many thanks, I appreciate it!

It's in point of fact a great

It's in point of fact a great and helpful piece of info.
I am happy that you simply shared this useful information with us.
Please stay us informed like this. Thank you for sharing.

And that is an funding threat

And that is an funding threat price taking.

Hi, Neat post. There is an

Hi, Neat post. There is an issue along with your
site in web explorer, would check this? IE still is the marketplace chief and
a huge component to other people will miss your fantastic writing due to this
problem.

Hello this is somewhat of off

Hello this is somewhat of off topic but I was wanting to know if blogs
use WYSIWYG editors or if you have to manually
code with HTML. I'm starting a blog soon but have no coding skills so I wanted
to get guidance from someone with experience. Any help would be greatly
appreciated!

You really make it seem so

You really make it seem so easy with your presentation but I
find this topic to be really something which I think I would never understand.

It seems too complex and very broad for me. I am looking forward for your
next post, I'll try to get the hang of it!

Schwab Intelligent Portfolios

Schwab Intelligent Portfolios invests in Schwab ETFs.

I’m not that much of a

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

When I initially left a

When I initially left a comment I seem to have clicked on the
-Notify me when new comments are added- checkbox and
now whenever a comment is added I recieve
four emails with the same comment. Is there a means you are
able to remove me from that service? Thank you!

What's up to every body, it's

What's up to every body, it's my first go to see of this web site; this website carries awesome and in fact excellent material designed for visitors.

Thanks very interesting blog!

Thanks very interesting blog!

Buyers do pay direct and

Buyers do pay direct and indirect costs.

I like it when people get

I like it when people get together and share thoughts.
Great blog, continue the good work!

Hi there just wanted to give

Hi there just wanted to give you a quick heads up and let you know a
few of the pictures aren't loading properly.
I'm not sure why but I think its a linking issue.
I've tried it in two different web browsers and both show
the same results.

you are truly a good

you are truly a good webmaster. The site loading pace is incredible.
It seems that you are doing any distinctive trick.

In addition, The contents are masterpiece. you've done a
great process on this matter!

appreciate it a whole lot

appreciate it a whole lot this website will be conventional plus relaxed

Schwab Clever Portfolios

Schwab Clever Portfolios invests in Schwab ETFs.

I am really loving the

I am really loving the theme/design of your site. Do you ever run into any web browser compatibility issues?
A handful of my blog audience have complained about my site not operating correctly in Explorer but looks great in Chrome.
Do you have any tips to help fix this problem?

Hello! I could have sworn

Hello! I could have sworn I've been to this blog before but after
reading through some of the post I realized it's new to me.
Anyways, I'm definitely delighted I found it and I'll be bookmarking
and checking back frequently!

This is true for investment

This is true for investment advice as nicely.

I am in fact delighted to

I am in fact delighted to read this weblog posts which
includes tons of helpful data, thanks for providing such statistics.

Generally I don't read

Generally I don't read article on blogs, however I wish to say that this write-up very compelled me to try and
do it! Your writing taste has been amazed me. Thank you, very nice article.

It's difficult to find

It's difficult to find educated people about this subject,
but you seem like you know what you're talking about! Thanks

All kinds of investments come

All kinds of investments come with certain dangers.

Article writing is also a

Article writing is also a excitement, if you know afterward you can write if not it is complex to write.

I like the valuable info you

I like the valuable info you provide on your articles.
I will bookmark your weblog and check again here frequently.

I am quite certain I will be told many new stuff proper right
here! Good luck for the next!

Wow, that's what I was

Wow, that's what I was exploring for, what a information! existing here at this weblog, thanks admin of this web page.

Hi there are using Wordpress

Hi there are using Wordpress for your blog platform?
I'm new to the blog world but I'm trying to get started and create
my own. Do you need any html coding knowledge to make your own blog?
Any help would be really appreciated!

A monetary advisor is your

A monetary advisor is your planning accomplice.

An interesting discussion is

An interesting discussion is worth comment. There's no doubt
that that you should write more on this issue,
it might not be a taboo matter but generally people don't talk about these
topics. To the next! Many thanks!!

I have been browsing on-line

I have been browsing on-line greater than 3 hours nowadays, yet I never found any attention-grabbing article like yours.

It's lovely value enough for me. In my view, if all web owners and bloggers made good
content as you probably did, the web will be a lot more useful than ever before.

This website was... how do I

This website was... how do I say it? Relevant!! Finally I've found something that helped me.

Thanks!

cheers a good deal this

cheers a good deal this website is actually professional plus relaxed

If you want to get a good

If you want to get a good deal from this paragraph then you have to apply such techniques to your won website.

You are so awesome! I don't

You are so awesome! I don't think I've truly read through
something like that before. So good to find another person with a few original
thoughts on this subject matter. Seriously.. thank you for starting this up.
This site is one thing that is needed on the web, someone with a little originality!

Link exchange is nothing else

Link exchange is nothing else except it is just placing the other person's weblog link on your page at suitable place and other person will
also do similar for you.

I do not even know how I

I do not even know how I ended up here, but I thought this post was
good. I don't know who you are but certainly you are going
to a famous blogger if you aren't already ;) Cheers!

This is true for funding

This is true for funding recommendation as nicely.

We're a group of volunteers

We're a group of volunteers and starting a new scheme in our community.
Your site offered us with valuable info to work on. You've
done a formidable job and our whole community will be thankful to you.

Thanks a lot for sharing this

Thanks a lot for sharing this with all people you really recognize what you're speaking approximately!
Bookmarked. Kindly additionally discuss with my website =).
We will have a hyperlink trade contract among us

Excellent way of telling, and

Excellent way of telling, and nice article to take facts concerning my presentation subject,
which i am going to present in university.

That is very interesting,

That is very interesting, You're an excessively professional blogger.
I've joined your feed and sit up for in quest of more of your excellent post.
Also, I have shared your website in my social networks

I do agree with all of the

I do agree with all of the ideas you've offered
for your post. They are very convincing and can definitely work.
Still, the posts are very short for starters.
May just you please lengthen them a little from next time?
Thanks for the post.

A financial advisor is your

A financial advisor is your planning companion.

My brother recommended I

My brother recommended I might like this website.

He was once entirely right. This submit actually made my
day. You cann't imagine simply how so much time I had spent for this information! Thank you!

Hi to all, how is all, I

Hi to all, how is all, I think every one is getting more from this website, and your views
are fastidious in favor of new people.

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.