Dátumformátum + dátumformátum-típus exportálása

  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • 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

I enjoy what you guys are up

I enjoy what you guys are up too. Such clever work and exposure! Keep up the very good works guys I've added you guys to our blogroll.|

whoah this blog is wonderful

whoah this blog is wonderful i like studying your articles. Stay up the good work! You realize, a lot of people are searching around for this info, you can aid them greatly. |

Yes! Finally someone writes

Yes! Finally someone writes about %keyword1%.|

Your means of explaining all

Your means of explaining all in this post is genuinely good, every one be able to easily know it, Thanks a lot.|

Hi, i think that i saw you

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

Since the admin of this site

Since the admin of this site is working, no doubt very soon it will be well-known, due to its feature contents.|

Aw, this was an extremely

Aw, this was an extremely nice post. Taking a few minutes and actual effort to generate a good article… but what can I say… I hesitate a whole lot and don't seem to get nearly anything done.|

I needed to thank you for

I needed to thank you for this great read!! I certainly enjoyed every little bit of it. I have you book marked to look at new things you post…|

I just couldn't leave your

I just couldn't leave your site prior to suggesting that I actually enjoyed the usual info a person supply for your guests? Is going to be again ceaselessly to inspect new posts|

If you would like to increase

If you would like to increase your knowledge simply keep visiting this website and be updated with the most up-to-date news update posted here.|

Thanks for finally writing

Thanks for finally writing about >Válasz a hozzászólásra

Having read this I thought it

Having read this I thought it was very informative. I appreciate you finding the time and energy to put this article together. I once again find myself spending way too much time both reading and commenting. But so what, it was still worthwhile!|

Hmm it looks like your blog

Hmm it looks like your blog ate my first comment (it was extremely long) so I guess I'll just sum it up what I submitted and say, I'm thoroughly enjoying your blog. I too am an aspiring blog writer but I'm still new to everything. Do you have any suggestions for rookie blog writers? I'd genuinely appreciate it.|

Terrific article! This is the

Terrific article! This is the type of info that are meant to be shared around the internet. Shame on the search engines for no longer positioning this put up higher! Come on over and discuss with my website . Thanks =)|

As the admin of this web site

As the admin of this web site is working, no hesitation very quickly it will be famous, due to its feature contents.|

Pretty nice post. I just

Pretty nice post. I just stumbled upon your blog and wanted to say that I have truly enjoyed surfing around your blog posts. In any case I'll be subscribing to your feed and I hope you write again very soon!|

I think this is one of the

I think this is one of the most important information for me. And i'm glad reading your article. But should remark on few general things, The web site style is wonderful, the articles is really excellent : D. Good job, cheers|

I'm really enjoying the

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

Excellent web site you've got

Excellent web site you've got here.. It's hard to find excellent writing like yours these days. I seriously appreciate people like you! Take care!!|

An interesting discussion is

An interesting discussion is definitely worth comment. There's no doubt that that you need to publish more on this topic, it might not be a taboo matter but usually folks don't discuss these subjects. To the next! Kind regards!!|

When someone writes an

When someone writes an paragraph he/she keeps the thought of a user in his/her brain that how a user can understand it. So that's why this article is perfect. Thanks!|

Thanks for your personal

Thanks for your personal marvelous posting!
I certainly enjoyed reading it, you may be a great author.I will make
sure to bookmark your blog and definitely will come back someday.

I want to encourage continue your great writing, have a nice day!

That is a great tip

That is a great tip especially to those new to the blogosphere. Short but very accurate info… Thanks for sharing this one. A must read post!|

Howdy, I do think your

Howdy, I do think your website may be having internet browser compatibility issues. Whenever I look at your website in Safari, it looks fine but when opening in I.E., it's got some overlapping issues. I just wanted to provide you with a quick heads up! Aside from that, fantastic site!|

Hi, I read your new stuff

Hi, I read your new stuff regularly. Your story-telling style is awesome, keep doing what you're doing!|

Cnc Lathe With Inclined Bed

Hello I am so delighted I

Hello I am so delighted I found your webpage, I really found you by mistake, while I was looking on Bing for something else, Anyhow I am here now and would just like to say kudos for a remarkable post and a all round interesting blog (I also love the theme/design), I don't have time to read through it all at the minute but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the great work.|

Good article! We will be

Good article! We will be linking to this great post on our site. Keep up the great writing.|

Hi, i think that i saw you

Hi, i think that i saw you visited my site thus i came to go back the want?.I'm trying to in finding issues to enhance my website!I suppose its ok to make use of a few of your ideas!!|

Hello would you mind stating

Hello would you mind stating which blog platform you're working with? I'm planning to start my own blog in the near future but I'm having a hard time selecting between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I'm looking for something completely unique. P.S My apologies for getting off-topic but I had to ask!|

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 have learn this publish and if I may just I wish to suggest you few attention-grabbing things or advice. Perhaps you could write next articles regarding this article. I wish to read more things approximately it!|

Great blog you have here but

Great blog you have here but I was curious if you knew of any discussion boards
that cover the same topics talked about here? I'd really love to
be a part of online community where I can get comments from other experienced individuals that share
the same interest. If you have any suggestions, please let me know.
Many thanks!

Thanks for every other

Thanks for every other informative blog. Where else may I am getting that kind of information written in such a perfect means? I have a project that I'm just now operating on, and I've been on the glance out for such information.|

I was recommended this web

I was recommended this web site through my cousin. I am now not certain whether this put up is written by way of him as nobody else understand such specific approximately my problem. You are incredible! Thanks!|

I constantly spent my half an

I constantly spent my half an hour to read this weblog's articles or reviews all the time along with a cup of coffee.|

Greetings! This is my first

Greetings! This is my first visit to your blog! We are a team of volunteers and starting a new initiative in a community in the same niche. Your blog provided us useful information to work on. You have done a marvellous job!|

What's up colleagues, good

What's up colleagues, good post and fastidious urging commented at this place, I am truly enjoying by these.|

Excellent post. Keep posting

Excellent post. Keep posting such kind of info on your site. Im really impressed by it.

Do you have a spam problem on

Do you have a spam problem on this site; I also am a blogger, and I was curious about your situation; many of us have created some nice practices and we are looking to exchange methods with other folks, be sure to shoot me an e-mail if interested.|

Hi there, i read your blog

Hi there, i read your blog from time to time and i own a similar one and i was just wondering if you get a lot of spam remarks? If so how do you stop it, any plugin or anything you can suggest? I get so much lately it's driving me mad so any help is very much appreciated.|

Hi to every body, it's my

Hi to every body, it's my first go to see of this web site; this website consists of remarkable and actually fine information in support of readers.|

This article will assist the

This article will assist the internet viewers for creating
new webpage or even a weblog from start to end.

Hey there! I just wanted to

Hey there! I just wanted to ask if you ever have any trouble with hackers? My last blog (wordpress) was hacked and I ended up losing many months of hard work due to no data backup. Do you have any methods to prevent hackers?|

At this time it looks like

At this time it looks like Wordpress is the best blogging platform out there right now. (from what I've read) Is that what you are using on your blog?|

It's hard to find

It's hard to find well-informed people for this topic, but you seem like you
know what you're talking about! Thanks

It's remarkable to visit this

It's remarkable to visit this site and reading the views of all mates concerning this
paragraph, while I am also keen of getting familiarity.

I have been surfing on-line

I have been surfing on-line greater than 3 hours nowadays, yet I by no means found any interesting article like yours. It's beautiful value sufficient for me. In my opinion, if all website owners and bloggers made good content material as you did, the net shall be much more useful than ever before.|

What i don't realize is in

What i don't realize is in reality how you're now not actually a lot more neatly-appreciated than you may be right now. You are so intelligent. You realize thus significantly in terms of this matter, produced me personally believe it from a lot of varied angles. Its like men and women are not interested except it's something to accomplish with Woman gaga! Your own stuffs outstanding. At all times care for it up!|

I read this paragraph fully

I read this paragraph fully concerning the resemblance of hottest and earlier technologies, it's awesome article.|

Just want to say your article

Just want to say your article is as amazing. The clearness for your publish is simply spectacular and i can assume you're knowledgeable in this subject.
Fine along with your permission allow me to clutch your RSS feed to keep up to date with imminent post.
Thank you 1,000,000 and please keep up the rewarding work.

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.