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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
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

You need to be a part of a

You need to be a part of a contest for one of the
most useful sites online. I most certainly will recommend this blog!

Oh my goodness! Incredible

Oh my goodness! Incredible article dude! Many thanks, However I am encountering difficulties with your RSS.
I don't understand the reason why I am unable to subscribe to it.

Is there anybody else having the same RSS problems?
Anyone that knows the answer can you kindly respond? Thanks!!

It's really a great and

It's really a great and useful piece of info. I'm satisfied that
you shared this helpful information with us. Please keep us informed like this.
Thank you for sharing.

This design is incredible!

This design is incredible! You obviously 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!) Excellent job.

I really loved what you had to say, and more than that,
how you presented it. Too cool!

Hello there, You have done a

Hello there, You have done a great job. I'll definitely digg it
and personally suggest to my friends. I am sure they'll
be benefited from this website.

Fine way of describing, and

Fine way of describing, and fastidious paragraph to take information concerning my presentation focus, which
i am going to present in academy.

Quality articles or reviews

Quality articles or reviews is the secret to attract the users to go to see the site, that's what this web site is providing.

Wow, that's what I was

Wow, that's what I was exploring for, what a material!
present here at this web site, thanks admin of
this website.

This is my first time visit

This is my first time visit at here and i am in fact happy to read all at one place.

There's definately a lot to

There's definately a lot to learn about this subject.
I really like all of the points you have made.

Hi there, I desire to

Hi there, I desire to subscribe for this weblog to take
most up-to-date updates, therefore where can i do it please assist.

Think about investments that

Think about investments that offer quick annuities.

Helpful information.

Helpful information. Fortunate me I discovered your website
accidentally, and I am surprised why this coincidence didn't took place earlier!
I bookmarked it.

Having read this I believed

Having read this I believed it was very enlightening. I appreciate you taking the time and effort to put this informative
article together. I once again find myself personally spending a
significant amount of time both reading and
leaving comments. But so what, it was still worthwhile!

I absolutely love your blog

I absolutely love your blog and find the majority of your post's to be just what I'm looking for.
Would you offer guest writers to write content in your case?
I wouldn't mind producing a post or elaborating on most of the subjects you write related to here.

Again, awesome weblog!

Wonderful blog! I found it

Wonderful blog! I found it while browsing on Yahoo News.
Do you have any tips on how to get listed in Yahoo News?

I've been trying for a while but I never seem to get there!
Appreciate it

For most up-to-date

For most up-to-date information you have to pay a quick
visit internet and on world-wide-web I found this web page as a most excellent site for newest updates.

It's a pity you don't have a

It's a pity you don't have a donate button! I'd most certainly donate to
this excellent blog! I guess for now i'll
settle for book-marking and adding your RSS feed to my Google account.
I look forward to fresh updates and will share this site
with my Facebook group. Chat soon!

What i don't understood is in

What i don't understood is in fact how you are now not really much more smartly-preferred than you may be
right now. You are very intelligent. You recognize
therefore significantly in relation to this subject, produced me in my view consider it from a lot
of varied angles. Its like men and women don't seem to
be interested except it's something to accomplish with Lady
gaga! Your individual stuffs excellent. Always take care of it up!

Hi, Neat post. There's an

Hi, Neat post. There's an issue together with your website in internet explorer, could
check this? IE still is the marketplace chief and a
good part of folks will miss your fantastic writing due to this problem.

I do not even know the way I

I do not even know the way I ended up right here, however I thought this publish used to be good.
I do not recognise who you might be however certainly you're going to
a famous blogger for those who are not already.
Cheers!

Thanks to my father who told

Thanks to my father who told me about this webpage, this blog is really amazing.

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 images aren't loading correctly.
I'm not sure why but I think its a linking issue.
I've tried it in two different browsers and
both show the same results.

Hi there, its nice paragraph

Hi there, its nice paragraph regarding media print, we all know media is a
impressive source of data.

This site was... how do you

This site was... how do you say it? Relevant!! Finally I
have found something that helped me. Kudos!

Wow that was odd. I just

Wow that was odd. I just wrote an very long comment but after I clicked submit my comment didn't appear.
Grrrr... well I'm not writing all that over again. Regardless, just
wanted to say excellent blog!

Hello! Do you use Twitter?

Hello! Do you use Twitter? I'd like to follow you if that would be okay.
I'm absolutely enjoying your blog and look forward to new updates.

Incredible! This blog looks

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

Welcome to Morris Heating &

Welcome to Morris Heating & Cooling Inc.

Every weekend i used to pay a

Every weekend i used to pay a quick visit this site, for the
reason that i want enjoyment, since this
this web site conations really pleasant funny information too.

I for all time emailed this

I for all time emailed this webpage post page to all my associates, since if like to read it afterward
my friends will too.

Thank you for sharing your

Thank you for sharing your thoughts. I truly appreciate your efforts and I am waiting for your next post thanks once again.

When I originally commented I

When I originally commented I clicked the "Notify me when new comments are added" checkbox
and now each time a comment is added I get several emails with the
same comment. Is there any way you can remove me from that service?
Many thanks!

Thank you for another

Thank you for another wonderful post. Where else may just anyone get
that type of info in such a perfect manner of writing?
I've a presentation subsequent week, and I am on the search
for such information.

I loved as much as you'll

I loved as much as you'll receive carried out right here. The sketch is attractive, your authored material
stylish. nonetheless, you command get got an edginess over that you wish be delivering the following.
unwell unquestionably come more formerly again since exactly the same nearly
very often inside case you shield this increase.

I was suggested this web site

I was suggested this web site by my cousin. I am not sure whether this post is written by
him as nobody else know such detailed about my trouble.
You are amazing! Thanks!

Monetary advisors business is

Monetary advisors business is individuals business.

Keep this going please, great

Keep this going please, great job!

I constantly spent my half an

I constantly spent my half an hour to read this web site's articles everyday along with a mug of coffee.

Thank you a bunch for sharing

Thank you a bunch for sharing this with all people
you really understand what you are speaking about!
Bookmarked. Please additionally talk over with my site =).
We may have a hyperlink trade agreement among us

Everything is very open with

Everything is very open with a really clear explanation of the issues. It was really informative. Your website is very useful. Many thanks for sharing!

This is true for investment

This is true for investment advice as properly.

I am curious to find out what

I am curious to find out what blog platform you happen to be utilizing?

I'm experiencing some minor security issues with my latest blog and
I'd like to find something more safe. Do you have any recommendations?

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 appreciate your content.

Please let me know. Cheers

This paragraph will help the

This paragraph will help the internet people for setting
up new web site or even a blog from start to end.

What's up, of course this

What's up, of course this paragraph is in fact nice and I have learned lot
of things from it regarding blogging. thanks.

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 do not know who you are but definitely you are going to a famous blogger if you
aren't already ;) Cheers!

Hi, i think that i noticed

Hi, i think that i noticed you visited my site so i
got here to go back the desire?.I am trying to in finding
things to improve my website!I assume its adequate to make use of some of your ideas!!

These are actually enormous

These are actually enormous ideas in on the topic of blogging.
You have touched some nice points here. Any way keep up wrinting.

This is true for funding

This is true for funding recommendation as nicely.

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.