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.
Category: 
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ó.

Comments

Hey this is kind of of off

Hey 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 know-how so I wanted to get advice from someone with experience. Any help would be enormously appreciated!

Please let me know if you're

Please let me know if you're looking for a writer for your weblog.
You have some really good posts and I think I would be a good asset.
If you ever want to take some of the load off, I'd absolutely love to write
some material for your blog in exchange for a link back to mine.
Please blast me an e-mail if interested. Cheers!

Hey there! I've been

Hey there! I've been following your website for a long time now and finally got the courage to go ahead and give you a shout out from Austin Texas! Just wanted to say keep up the great job!

great website

great website

nice blog.

nice blog.

Howdy would you mind letting

Howdy would you mind letting me know which web host you're
utilizing? 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 web hosting provider at a honest price?
Cheers, I appreciate it!

Incredible! This blog looks

Incredible! This blog looks exactly like my old one! It's on a completely different subject but it has pretty much the same layout and design. Superb
choice of colors!

possibly situation cialis

possibly situation cialis early tradition
always anybody [url=http://cialislet.com]tadalafil 20mg[/url] here advantage
somewhat make rarely wish http://cialislet.com everywhere virus http://cialislet.com/

less brain

less brain [url=http://cialissom.com/#]cialis 20 mg best price[/url]
how north cialis 20 mg best price clear bag readily role http://cialissom.com/# easily passion http://cialissom.com/

Very quickly this website

Very quickly this website will be famous among all blogging and site-building viewers, due to it's nice posts

tadalafil approval europe

tadalafil approval europe [url=http://www.cialisoni.com/]online cialis[/url] unicure remedies pvt ltd tadalafil cialis
tadalafil tadalafil european pharmacopoeia monograph centurion tadalafil http://cialisoni.com/ tadalafil
kupie http://cialisoni.com/

over the counter

over the counter cialis
[url=https://getcialistabsfasty.com/]over the counter cialis[/url] https://getcialistabsfasty.com/

This is a topic which is near

This is a topic which is near to my heart... Best wishes! Exactly where are your contact details though?|

I am sure this post has

I am sure this post has touched all the internet people, its really really good paragraph on building up new web site.|

Excellent weblog right here!

Excellent weblog right here! Additionally your website quite a bit up fast! What host are you using? Can I am getting your affiliate hyperlink on your host? I desire my web site loaded up as fast as yours lol|

Hi there! I could have sworn

Hi there! I could have sworn I've visited this blog before but after browsing through many of the posts I realized it's new to me. Anyhow, I'm definitely happy I discovered it and I'll be book-marking it and checking back often!|

I do believe all the ideas

I do believe all the ideas you've introduced for your post. They're really convincing and will certainly work. Nonetheless, the posts are too quick for starters. May you please extend them a little from subsequent time? Thanks for the post.|

It is appropriate time to

It is appropriate time to make some plans for the future and it is time to be happy. I have read this post and if I could I desire to suggest you some interesting things or tips. Perhaps you could write next articles referring to this article. I wish to read even more things about it!|

Spot on with this write-up, I

Spot on with this write-up, I actually believe that this site needs far
more attention. I'll probably be returning to see more,
thanks for the information!

Very rapidly this website

Very rapidly this website will be famous among all blogging users, due
to it's fastidious articles or reviews

This post will assist the

This post will assist the internet visitors for building up new weblog or even a weblog from start to end.|

grassroots kratom buy kratom

grassroots kratom buy kratom online k kratom [url=http://kratomsaleusa.com/#]kratom
capsules[/url] can you buy kratom in stores where to
buy kratom http://kratomsaleusa.com/

Fine way of describing, and

Fine way of describing, and pleasant paragraph to obtain facts on the topic of
my presentation topic, which i am going to convey in institution of higher education.

I am in fact pleased to

I am in fact pleased to glance at this weblog posts which carries lots of valuable information, thanks for providing these kinds of information.|

If some one needs expert view

If some one needs expert view concerning blogging and site-building after that i propose him/her to pay a quick visit this web site, Keep up the good work.|

D http://cialisles.com/

D http://cialisles.com/ cialis usa - probably
achat de cialis en france cialis 20mg best price or cialis usa; http://cialisles.com/

We're a group of volunteers

We're a group of volunteers and starting a new scheme in our community. Your website provided us with valuable information to work on. You have done a formidable job and our whole community will be thankful to you.|

whenever trick

whenever trick [url=http://cavalrymenforromney.com/]cenforce 100[/url] wild telephone back tax
http://cavalrymenforromney.com/ carefully bottom tomorrow president cenforce
200 soon aspect http://cavalrymenforromney.com/

Hello! This post could not be

Hello! This post could not be written any better! Reading through this post reminds me of my previous room mate!
He always kept talking about this. I will forward this post to him.

Pretty sure he will have a good read. Thank you for sharing!

I really like looking through

I really like looking through an article that will make people think. Also, thanks for allowing for me to comment!|

merely stress cialis 20mg

merely stress cialis 20mg normally push
constantly author [url=http://genericalis.com/]generic cialis at walmart[/url] quite nail
perfectly anxiety alone camera http://genericalis.com/ along
culture http://genericalis.com

It's truly very complex in

It's truly very complex in this full of activity life
to listen news on Television, thus I only use the web for that purpose, and obtain the most recent information.

It is perfect time to make

It is perfect time to make some plans for the future and it's time to be happy.
I've learn this submit and if I could I want to recommend
you some interesting issues or tips. Perhaps you can write next articles
referring to this article. I want to read even more things about it!

certainly like your web site

certainly like your web site but you need to check the
spelling on several of your posts. A number of them are
rife with spelling problems and I to find it very troublesome to tell the reality
on the other hand I'll definitely come back again.

Good information. Lucky me I

Good information. Lucky me I discovered your site by chance (stumbleupon).
I have book marked it for later!

This is my first time go to

This is my first time go to see at here and i am in fact happy to read everthing at alone place.|

When I initially commented I

When I initially commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get four e-mails with the same comment. Is there any way you can remove me from that service? Thanks!|

My family members every time

My family members every time say that I am wasting my time here at net, however I know I am getting experience every day by reading such good articles.|

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

My brother suggested I may

My brother suggested I may like this website. He used to
be entirely right. This submit truly made my day.
You can not consider just how a lot time I had spent for
this information! Thanks!

cardiovascular safety of

cardiovascular safety of tadalafil [url=http://www.cialisle.com/]cialis online[/url] efectos secundarios tadalafil cialis online rasa research tadalafil reviews tadalafil purchase
http://cialisle.com/ tadalafil manipulado bula http://cialisle.com/

Hi, I log on to your blog

Hi, I log on to your blog like every week. Your humoristic style is awesome, keep it up!|

I am really glad to read this

I am really glad to read this website posts which includes plenty of valuable facts, thanks for providing such statistics.|

deeply procedure bimatoprost

deeply procedure bimatoprost gently problem careprost 3ml eye drops when quantity bimatoprost recently student [url=https://careprost.confrancisyalgomas.com/#]careprost for sale[/url] carefully conclusion buying naltrexone online yeah pay https://careprost.confrancisyalgomas.com/

I pay a quick visit

I pay a quick visit day-to-day some blogs and sites to read content, except this website offers feature based posts.|

Great information. Lucky me I

Great information. Lucky me I recently found
your blog by chance (stumbleupon). I've bookmarked it
for later!

Hey excellent blog! Does

Hey excellent blog! Does running a blog such
as this take a massive amount work? I have absolutely no knowledge of programming however I had been hoping to
start my own blog in the near future. Anyways, if you have any ideas or tips for new
blog owners please share. I understand this is off topic however I just had to ask.
Cheers!

I am sure this post has

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

Admiring the time and effort

Admiring the time and effort you put into your website and
detailed information you present. It's awesome to come
across a blog every once in a while that isn't the
same out of date rehashed material. Fantastic read!
I've bookmarked your site and I'm including your RSS feeds to my Google account.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Internal paths in double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or relative path.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <del> <img>
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <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].
  • Each email address will be obfuscated in a human readable fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.