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

Oh my goodness! Incredible

Oh my goodness! Incredible article dude! Many thanks, However I am having troubles with your RSS.

I don't know why I can't subscribe to it. Is there anyone else having
identical RSS problems? Anybody who knows the answer can you kindly respond?
Thanx!!

I couldn't resist commenting.

I couldn't resist commenting. Very well written!

Hi there, I enjoy reading

Hi there, I enjoy reading through your article. I wanted to write a little comment to
support you.

Its like you read my mind!

Its like you read my mind! You seem to grasp a lot about this, such as you
wrote the e book in it or something. I feel that you simply can do with a few p.c.
to drive the message home a little bit, however instead of that, that is excellent
blog. An excellent read. I'll certainly be back.

Every weekend i used to visit

Every weekend i used to visit this web site, because i wish for enjoyment,
since this this web page conations in fact fastidious funny material too.

Wonderful blog! I found it

Wonderful blog! I found it while surfing around 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!
Thank you

I love what you guys are up

I love what you guys are up too. This kind of clever work and exposure!
Keep up the wonderful works guys I've added you guys
to my own blogroll.

Hi to every body, it's my

Hi to every body, it's my first visit of this weblog;
this weblog carries awesome and in fact fine material in favor of readers.

It's awesome in favor of me

It's awesome in favor of me to have a site, which is beneficial
in favor of my knowledge. thanks admin

Thank you for the auspicious

Thank you for the auspicious writeup. It actually was once a
enjoyment account it. Glance complicated to far delivered agreeable from you!
However, how could we keep in touch?

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

I guess for now i'll settle for bookmarking and adding your RSS feed to my Google account.

I look forward to new updates and will share this site with my Facebook group.
Talk soon!

Thanks in favor of sharing

Thanks in favor of sharing such a good opinion, piece of writing is
pleasant, thats why i have read it completely

Greetings from Carolina! I'm

Greetings from Carolina! I'm bored to death at work so I decided to browse your
site on my iphone during lunch break. I really like the information you provide here and can't
wait to take a look when I get home. I'm amazed
at how quick your blog loaded on my cell phone ..

I'm not even using WIFI, just 3G .. Anyhow, excellent site!

I really like your blog..

I really like your blog.. very nice colors & theme. Did you
make this website yourself or did you hire someone to do it for you?
Plz reply as I'm looking to construct my own blog and would
like to find out where u got this from. cheers

Howdy! Quick question that's

Howdy! Quick question that's entirely off topic. Do you know
how to make your site mobile friendly? My site looks weird when browsing from
my apple iphone. I'm trying to find a theme or plugin that might
be able to resolve this problem. If you have any suggestions, please
share. Appreciate it!

Have you ever considered

Have you ever considered publishing an e-book
or guest authoring on other websites? I have a blog based
on the same subjects you discuss and would really
like to have you share some stories/information. I know my audience would
value your work. If you are even remotely interested, feel free to
send me an e-mail.

I like the valuable

I like the valuable information you provide on your articles.
I will bookmark your blog and check again here frequently.
I'm somewhat certain I will be told plenty of new stuff right here!
Good luck for the following!

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 read this post and if I could I desire to suggest you few interesting things or advice.
Maybe you could write next articles referring to this article.
I wish to read more things about it!

I used to be suggested this

I used to be suggested this blog via my cousin. I'm not sure whether this publish is written by him
as no one else understand such specific approximately my
problem. You're incredible! Thank you!

It's not my first time to

It's not my first time to visit this website, i am visiting this
website dailly and get nice information from here all the time.

constantly i used to read

constantly i used to read smaller articles or reviews that also clear their motive,
and that is also happening with this paragraph which I am reading now.

Nice post. I used to be

Nice post. I used to be checking constantly this blog and I am inspired!
Very helpful info particularly the ultimate section :)
I take care of such information a lot. I used to be seeking
this certain info for a very lengthy time. Thanks and best of luck.

Hey! Would you mind if I

Hey! Would you mind if I share your blog with
my facebook group? There's a lot of folks that I think would really appreciate your content.
Please let me know. Cheers

When I originally left a

When I originally left a comment I appear to have clicked on the
-Notify me when new comments are added- checkbox and now whenever a
comment is added I get four emails with the same comment.
Is there an easy method you are able to remove me from that service?
Many thanks!

Right now it appears like

Right now it appears like Wordpress is the top blogging platform available
right now. (from what I've read) Is that what you are using on your blog?

Hi! I simply want to offer

Hi! I simply want to offer you a huge thumbs up for the excellent information you
have here on this post. I will be coming back to your site for more soon.

It's an amazing piece of

It's an amazing piece of writing designed for all the online people;
they will take benefit from it I am sure.

Way cool! Some extremely

Way cool! Some extremely valid points! I appreciate you writing this write-up and
also the rest of the site is very good.

Whoa! This blog looks just

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

This paragraph provides clear

This paragraph provides clear idea designed for the new users of blogging,
that in fact how to do blogging and site-building.

nice blog.

nice blog.

Undeniably consider that that

Undeniably consider that that you stated. Your favorite reason seemed to be on the net the simplest thing to
be mindful of. I say to you, I certainly get annoyed whilst people consider worries
that they just don't realize about. You controlled to hit the nail
upon the highest and also defined out the entire thing with no need side-effects ,
folks could take a signal. Will probably be again to get more.
Thanks

Great blog here! Also your

Great blog here! Also your website loads up very fast! What host are you using?
Can I get your affiliate link to your host? I wish my site loaded
up as quickly as yours lol

It's a shame you don't have a

It's a shame you don't have a donate button! I'd certainly
donate to this fantastic blog! I suppose 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 talk about this blog with
my Facebook group. Chat soon!

I know this if off topic but

I know this if off topic but I'm looking into starting my own weblog
and was curious what all is required to get set up? I'm assuming having a blog like yours would cost a pretty penny?
I'm not very web smart so I'm not 100% certain.
Any tips or advice would be greatly appreciated. Kudos

Hi there to every one, the

Hi there to every one, the contents existing at this web
page are really amazing for people experience, well,
keep up the good work fellows.

Definitely believe that which

Definitely believe that which you stated. Your favorite justification seemed to be on the
web the easiest thing to be aware of. I say to you, I definitely get annoyed while people consider worries that they plainly do not
know about. You managed to hit the nail upon the top and also defined out the
whole thing without having side effect , people can take a signal.
Will probably be back to get more. Thanks

Great post. I used to be

Great post. I used to be checking constantly this weblog and I'm impressed!
Extremely useful information specially the last part :) I take
care of such info a lot. I was seeking this certain information for a long time.
Thanks and good luck.

Its like you read my mind!

Its like you read my mind! You appear to know
a lot approximately this, like you wrote the e book in it or something.
I think that you simply can do with some % to pressure the message house a little bit, however instead of that, that
is excellent blog. A fantastic read. I'll definitely be back.

Please let me know if you're

Please let me know if you're looking for a article writer for
your blog. 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 email if interested.
Thanks!

Simply want to say your

Simply want to say your article is as amazing.
The clarity in your post is just excellent and i can assume you're an expert on this
subject. Fine with your permission allow me to grab your RSS feed to keep up to date with forthcoming
post. Thanks a million and please carry on the enjoyable work.

Magnificent beat ! I wish to

Magnificent beat ! I wish to apprentice while you amend your site, how could i subscribe for a blog website?
The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast
offered bright clear concept

Hmm is anyone else having

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

Nice post. I used to be

Nice post. I used to be checking continuously this blog and I am impressed!

Very helpful information specially the ultimate section :) I handle such info
much. I used to be seeking this certain information for a long
time. Thank you and good luck.

Generally I do not learn

Generally I do not learn article on blogs, however
I would like to say that this write-up very forced me to take a look at and
do so! Your writing style has been amazed me. Thanks, quite nice
post.

Hi there are using Wordpress

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

Ahaa, its pleasant dialogue

Ahaa, its pleasant dialogue on the topic of this
piece of writing at this place at this website, I have read all that, so now me also commenting at this place.

I know this if off topic but

I know this if off topic but I'm looking into starting my own blog and was wondering what all is
needed to get set up? I'm assuming having a blog
like yours would cost a pretty penny? I'm not very web smart so I'm not 100% certain. Any recommendations or advice would
be greatly appreciated. Cheers

I like it when folks come

I like it when folks come together and share thoughts. Great website, stick with it!

Yesterday, while I was at

Yesterday, while I was at work, my sister stole my apple
ipad and tested to see if it can survive a 25 foot drop,
just so she can be a youtube sensation. My apple ipad is
now destroyed and she has 83 views. I know this is totally off topic but I had to share it
with someone!

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.