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

Every weekend i used to go to

Every weekend i used to go to see this website, for the reason that i wish for enjoyment, as this this site conations truly fastidious funny data too.

Fantastic Site, Maintain the

Fantastic Site, Maintain the beneficial work. With thanks!|

Thanks for sharing your info.

Thanks for sharing your info. I really appreciate your efforts
and I am waiting for your next post thank you once again.

khda.kr. exodium.

Heya i am for the primary

Heya i am for the primary time here. I came across this board and I to find It really helpful & it helped me out much.
I'm hoping to give something again and aid others such as you aided me.

malosh. stayhere.

Attractive section of

Attractive section of content. I just stumbled upon your blog and in accession capital to assert that I get actually enjoyed account your blog posts.
Anyway I'll be subscribing to your feeds and even I achievement you
access consistently rapidly.

I’ve been having some

I’ve been having some problems compiling my lists as of late.
I’m running this in hopes of creating a new up to date list.
Stay tuned and visit my website soon. I hope to add a new list
in the not so distant future.

Its like you read my mind!

Its like you read my mind! You appear to know a lot
about this, like you wrote the book in it
or something. I think that you can do with some pics to drive
the message home a little bit, but other than that, this is wonderful
blog. An excellent read. I will certainly be back.

Undeniably believe that which

Undeniably believe that which you said. Your favorite reason appeared to be on the internet the easiest thing to be
aware of. I say to you, I definitely get irked while people think
about worries that they just do not know about. You managed to hit the nail upon the top
and also defined out the whole thing without having side-effects
, people could take a signal. Will likely be back to get more.

Thanks

Superb post but I was wanting

Superb post but I was wanting to know if you could write a kdeaebkckfdf

Appreciate the

Appreciate the recommendation. Let me try it out.

Astonishingly individual

Astonishingly individual friendly website. Immense information offered on few clicks on.

With havin so much content

With havin so much content and articles do you ever run into
any issues of plagorism or copyright violation? My website has a lot of exclusive content I've either created myself or
outsourced but it seems a lot of it is popping it up all over the web without my permission. Do you
know any ways to help protect against content from being ripped
off? I'd truly appreciate it.

Hi Dear, are you really

Hi Dear, are you really visiting this site regularly, if so then you will without doubt get
pleasant knowledge.

Thank you a lot for sharing

Thank you a lot for sharing this with all people you really realize what you are speaking about!
Bookmarked. Please also discuss with my web site =).
We can have a link trade contract between us

Its like you read my mind!

Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something.
I think that you could do with some pics to drive the message home a bit,
but other than that, this is great blog. A fantastic read.
I'll definitely be back.

This design is steller! You

This design is steller! 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!) Great job.
I really loved what you had to say, and more than that, how you presented
it. Too cool!

Thanks for the purpose of

Thanks for the purpose of offering like terrific subject material.

I think the admin of this

I think the admin of this website is really
working hard in favor of his web site, for the
reason that here every information is quality based material.

I just like the helpful

I just like the helpful information you provide on your articles.
I will bookmark your weblog and take a look at once more here frequently.
I am quite sure I'll be told a lot of new stuff proper here!
Best of luck for the following!

Now it's time to decide your

Now it's time to decide your specific investments.

Cool webpage you've going

Cool webpage you've going here.

Truly when someone doesn't be

Truly when someone doesn't be aware of after that its up to other visitors that they will help, so here it
occurs.

malosh. stayhere.

I read this piece of writing

I read this piece of writing completely concerning the difference of newest
and earlier technologies, it's amazing article.

Please let me know if you're

Please let me know if you're looking for a writer for your site.
You have some really good articles and I think I would be a good
asset. If you ever want to take some of the load off, I'd really like to write some content for your blog in exchange for a link back to
mine. Please send me an e-mail if interested.
Kudos!

ysiaq. malosh.

hi!,I like your writing so so

hi!,I like your writing so so much! percentage we keep up a correspondence more approximately your article on AOL?
I require an expert on this house to resolve my problem. Maybe that's you!

Looking forward to see you.

Thank you so much for sharing

Thank you so much for sharing this superb webpage.

It's going to be finish of

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

Hi are using Wordpress for

Hi are using Wordpress for your blog platform?
I'm new to the blog world but I'm trying to get started and set up
my own. Do you need any html coding knowledge to make your own blog?
Any help would be really appreciated!

You've the most impressive

You've the most impressive web sites.

Hey, I think your site might

Hey, I think your site might be having browser compatibility issues.
When I look at your blog site in Safari, it looks fine but when opening in Internet Explorer, it
has some overlapping. I just wanted to give you
a quick heads up! Other then that, great blog!

Sustain the helpful job and

Sustain the helpful job and delivering in the crowd!

Excellent post. I was

Excellent post. I was checking continuously this blog
and I'm impressed! Very useful information specifically the last part :) I care for such info much.
I was looking for this particular info for a very
long time. Thank you and good luck.

libresite. clevio.

Good post. I learn something

Good post. I learn something new and challenging on websites I stumbleupon everyday.
It's always exciting to read through content from other authors and use a little something from other websites.

I enjoy reading through an

I enjoy reading through an article that will make people think.
Also, many thanks for allowing for me to comment!

My relatives always say that

My relatives always say that I am killing my time here at net, however I know I am getting know-how
daily by reading thes pleasant posts.

happy to visit your website

happy to visit your website and can share information like my website that provides information about health for example,
Obat Herbal Penyakit Radang Lambung
Obat Sakit Ambeien Akut
Obat Herbal Penyakit Ambeien

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.