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

Hello there! I know this is

Hello there! I know this is kinda off topic but I was wondering which blog platform are you using for this website? I'm getting tired of Wordpress because I've had problems with hackers and I'm looking at alternatives for another platform. I would be awesome if you could point me in the direction of a good platform.|

If you want to take much from

If you want to take much from this piece of writing then you have to apply these strategies to your won webpage.|

It's going to be end of mine

It's going to be end of mine day, but before finish I am reading this enormous post to improve my know-how.|

If you are going for most

If you are going for most excellent contents like I do, simply visit this web page every day for the reason that it gives feature contents, thanks|

I don't even know how I

I don't even know how I stopped up here, but I thought this post used to be great. I don't realize who you are however definitely you're going to a famous blogger if you are not already. Cheers!|

This is really interesting,

This is really interesting, You are a very
skilled blogger. I have joined your feed and look forward to seeking more of
your wonderful post. Also, I've shared your web site in my social
networks!

I just could not depart your

I just could not depart your site prior to suggesting that I really enjoyed the usual info
an individual supply in your visitors? Is gonna be back regularly to check up on new
posts

Hi there all, here every one

Hi there all, here every one is sharing these kinds of know-how, so it's nice to read this blog, and I used to pay a visit this weblog everyday.|

This design is incredible!

This design is incredible! You certainly know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost...HaHa!) Wonderful job. I really loved what you had to say, and more than that, how you presented it. Too cool!|

I have read so many articles

I have read so many articles or reviews about the blogger lovers but this piece of writing is actually a pleasant post, keep it up.|

Hi would you mind letting me

Hi would you mind letting me know which hosting company you're using? I've loaded your blog in 3 completely different web browsers and I must say this blog loads a lot faster then most. Can you suggest a good internet hosting provider at a honest price? Thanks a lot, I appreciate it!|

I've read a few good stuff

I've read a few good stuff here. Certainly worth bookmarking for revisiting. I surprise how a lot effort you set to make such a great informative website.|

Hello there, I discovered

Hello there, I discovered your blog by the use of Google
whilst looking for a similar subject, your web site came up, it seems to be
good. I've bookmarked it in my google bookmarks.

Hello there, just become aware of your weblog via Google, and found that
it's truly informative. I am gonna be careful for brussels.
I will be grateful should you continue this
in future. Numerous people will be benefited out of
your writing. Cheers!

Hmm is anyone else

Hmm is anyone else encountering problems with the pictures on this blog loading?
I'm trying to figure out if its a problem on my end or if it's the blog.
Any feedback would be greatly appreciated.

Hi there to all, the contents

Hi there to all, the contents existing at this web site are in fact remarkable for people experience, well, keep up the good work fellows.|

Every weekend i used to visit

Every weekend i used to visit this web site, for the reason that i wish for enjoyment, as this this web page conations in fact fastidious funny information too.|

Hey there, You have done a

Hey there, You have done a fantastic job. I will definitely digg
it and personally recommend to my friends. I'm sure they'll be benefited
from this web site.

I am genuinely pleased to

I am genuinely pleased to glance at this web site posts which contains plenty of useful information, thanks for providing these kinds of statistics.|

Hi, i think that i saw you

Hi, i think that i saw you visited my weblog thus i came to “return the favor”.I'm trying to find things to enhance my site!I suppose its ok to use some of your ideas!!|

It's perfect time to make a

It's perfect time to make a few plans for the future and it is time to be happy. I've learn this submit and if I could I want to counsel you some interesting things or advice. Maybe you can write subsequent articles relating to this article. I desire to learn more things approximately it!|

Hi there mates, how is all,

Hi there mates, how is all, and what you wish for to say on the topic of this piece of writing, in my view its really amazing designed
for me.

I've been browsing online

I've been browsing online more than three hours today, yet I never found any interesting article like yours. It's pretty worth enough for me. In my opinion, if all site owners and bloggers made good content as you did, the net will be a lot more useful than ever before.|

I'm gone to tell my little

I'm gone to tell my little brother, that he should also pay a visit this blog on regular basis to get updated from hottest information.|

Usually I do not learn

Usually I do not learn article on blogs, but I wish to say that this write-up very pressured me to try and do it! Your writing style has been surprised me. Thanks, very nice article.|

Your style is unique compared

Your style is unique compared to other folks I've read stuff from.

Many thanks for posting when you've got the opportunity, Guess I will
just book mark this blog.

I every time spent my half an

I every time spent my half an hour to read this blog's articles everyday along with a mug of coffee.|

I am truly thankful to the

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

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 truly useful & it helped me out much. I hope to provide one thing again and aid others such as you helped me.|

I think this is one of the

I think this is one of the such a lot significant information for me. And i am glad studying your article. But should remark on few normal things, The web site style is great, the articles is in reality nice : D. Excellent task, cheers|

A fascinating discussion is

A fascinating discussion is definitely worth comment. There's no doubt that that you ought to publish more about this subject, it may not be a taboo matter but generally folks don't talk about such subjects. To the next! Many thanks!!|

Howdy! I know this is kind of

Howdy! I know this is kind of off topic but I was wondering which blog platform are you using for this website? I'm getting sick and tired of Wordpress because I've had problems with hackers and I'm looking at alternatives for another platform. I would be fantastic if you could point me in the direction of a good platform.|

I simply could not depart

I simply could not depart your web site prior to suggesting that I extremely enjoyed the usual info an individual supply for your visitors? Is going to be again regularly in order to inspect new posts|

Hello, after reading this

Hello, after reading this amazing post i am also delighted to share my experience here with mates.|

Greetings I am so excited I

Greetings I am so excited I found your site, I really found you by error, 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 tremendous post and a all round enjoyable blog (I also love the theme/design), I don't have time to go through it all at the moment but I have book-marked it and also added in your RSS feeds, so when I have time I will be back to read more, Please do keep up the awesome job.|

We're a group of volunteers

We're a group of volunteers and opening a new scheme in our community. Your website provided us with valuable info to work on. You have done an impressive job and our entire community will be grateful to you.|

Hello, I desire to subscribe

Hello, I desire to subscribe for this website to take latest updates, thus where can i do it please assist.|

Greetings! Very useful advice

Greetings! Very useful advice in this particular article! It is the little changes which will make the largest changes. Many thanks for sharing!|

I like the helpful info you

I like the helpful info you provide in your articles. I will bookmark your blog and check again here regularly. I am quite sure I'll learn many new stuff right here! Good luck for the next!|

This paragraph will assist

This paragraph will assist the internet users for building up new webpage or even a weblog from start to end.

My coder is trying to

My coder is trying to persuade me to move to .net from PHP.
I have always disliked the idea because of the expenses.

But he's tryiong none the less. I've been using WordPress
on a variety of websites for about a year and am nervous about switching to another platform.

I have heard excellent things about blogengine.net.
Is there a way I can transfer all my wordpress posts into it?

Any help would be greatly appreciated!

Hi, I do believe this is a

Hi, I do believe this is a great site. I stumbledupon it ;) I'm going to revisit once again since I saved as a favorite it. Money and freedom is the best way to change, may you be rich and continue to guide other people.|

Howdy! Quick question that's

Howdy! Quick question that's completely off topic. Do you know how to make your site mobile friendly? My website looks weird when viewing from my iphone 4. I'm trying to find a theme or plugin that might be able to correct this issue. If you have any recommendations, please share. Many thanks!|

Howdy this is kind of of off

Howdy this is kind of 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 knowledge so I wanted to get advice from someone with experience. Any help would be enormously appreciated!|

Hello there, I do believe

Hello there, I do believe your blog might be having browser compatibility problems.
When I look at your web site in Safari, it looks fine however, if opening in I.E., it's got some overlapping issues.

I just wanted to give you a quick heads up! Aside from that, fantastic website!

Write more, thats all I have

Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You definitely know what youre talking about, why throw away your intelligence on just posting videos to your weblog when you could be giving us something enlightening to read?|

It's the best time to make

It's the best time to make some plans for the future and it's time to be happy. I have read this post and if I could I want to suggest you some interesting things or suggestions. Maybe you can write next articles referring to this article. I wish to read more things about it!|

Thanks for any other

Thanks for any other magnificent post. Where else may just
anybody get that type of info in such a perfect means of writing?
I have a presentation next week, and I'm on the look for
such info.

My relatives always say that

My relatives always say that I am killing my time here at web, except I know I am getting know-how daily by reading such pleasant articles or reviews.|

Thank you for any other

Thank you for any other fantastic post. The place else may anybody get that type of info in such an ideal manner of writing? I've a presentation subsequent week, and I'm on the search for such info.|

Howdy! Would you mind if I

Howdy! Would you mind if I share your blog with my zynga group?
There's a lot of people that I think would really enjoy your content.
Please let me know. Cheers

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.