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

freight forwarder hong kong -

freight forwarder hong kong - freight forwarder honolulu - freight forwarder là gì - freight forwarder job titles - freight forwarder from usa to uk

freight forwarding xpo -

freight forwarding xpo - freight forwarder conference 2019 - freight forwarder number lookup - freight forwarder vs shipper - freight forwarder business model

I am not sure where you're

I am not sure where you're getting your info, but great topic.

I needs to spend some time learning more or understanding more.
Thanks for excellent information I was looking for this
information for my mission.

freight forwarder jamaica -

freight forwarder jamaica - freight forwarder usa to uk - freight forwarder list usa - freight forwarder mississauga - freight forwarder russia

freight forwarder alaska -

freight forwarder alaska - freight forwarder belgium - freight forwarders for thailand - freight forwarder doral - freight forwarder amazon

freight forwarder trinidad -

freight forwarder trinidad - freight forwarder in thailand - freight forwarder jobs in karachi - freight forwarder recruitment agencies - freight forwarder dubai

Pretty section of content. I

Pretty section of content. I just stumbled upon your blog and in accession capital to assert that I get actually enjoyed account
your blog posts. Any way I'll be subscribing to your augment and even I achievement you
access consistently fast.

These are in fact great ideas

These are in fact great ideas in regarding blogging.

You have touched some pleasant points here.
Any way keep up wrinting.

freight forwarder kuala

freight forwarder kuala lumpur - freight forwarder in usa - freight forwarder vs fedex - freight forwarder scams - freight forwarder for sale

freight forwarder united

freight forwarder united states - freight forwarder belfast - freight forwarder sic code - freight forwarder china to thailand - freight forwarder uk to singapore

freight forwarder zimbabwe -

freight forwarder zimbabwe - freight forwarder karachi - freight forwarder agreement - freight forwarder tampa - freight forwarder you use

It's actually a great and

It's actually a great and useful piece of info. I am glad that you just shared this helpful info with us.
Please keep us up to date like this. Thank you for sharing.

freight forwarder what is -

freight forwarder what is - freight forwarder usa to canada - freight forwarder contract - freight forwarder list usa - freight forwarder fedex

freight forwarder definicion

freight forwarder definicion - freight forwarder terms and conditions - freight forwarder in french - freight forwarder en español - freight forwarder kansas city

freight forwarder jobs

freight forwarder jobs edmonton - freight forwarder in french - freight forwarder singapore - freight forwarder bangkok - freight forwarder usa to mexico

Hey just wanted to give you a

Hey just wanted to give you a quick heads up. The words in your content seem to be running off the screen in Internet explorer.
I'm not sure if this is a format issue or something to do with web browser compatibility but I thought I'd post
to let you know. The style and design look great though!
Hope you get the issue resolved soon. Many thanks

This information is

This information is invaluable. When can I find out more?

freight forwarder salary

freight forwarder salary canada - freight forwarder in bangladesh - freight forwarder examples - freight forwarder what do they do - freight forwarder poland

freight forwarder miami -

freight forwarder miami - freight forwarder dubai - freight forwarder startup - freight forwarder en español - freight forwarder responsibilities

It's awesome to pay a quick

It's awesome to pay a quick visit this website and
reading the views of all friends about this article, while I am also
zealous of getting knowledge.

freight forwarder vs motor

freight forwarder vs motor carrier - freight forwarder traduction - freight forwarder in french - freight forwarder education - freight forwarder panalpina

freight forwarders in yemen -

freight forwarders in yemen - freight forwarder in germany - freight forwarder queens ny - freight forwarder malta - freight forwarder payment terms

freight forwarder uk to

freight forwarder uk to singapore - freight forwarder japan to usa - freight forwarder usa to singapore - freight forwarder salary canada - freight forwarder ontario

Hi there, all is going well

Hi there, all is going well here and ofcourse every one is sharing facts, that's genuinely good,
keep up writing.

freight forwarder in

freight forwarder in singapore - freight forwarder florida - freight forwarder florida - freight forwarder lcl - freight forwarder risks

sky freight forwarders yanbu

sky freight forwarders yanbu - freight forwarder german - freight forwarder market share - freight forwarder yokohama - freight forwarder manager salary

Thanks for the marvelous

Thanks for the marvelous posting! I genuinely enjoyed reading it,
you may be a great author.I will be sure to bookmark
your blog and will often come back later on. I want to encourage one to continue your
great posts, have a nice holiday weekend!

freight forwarder ghana -

freight forwarder ghana - freight forwarder china to singapore - freight forwarder questions - freight forwarder leeds - freight forwarder johor bahru

I have read so many articles

I have read so many articles or reviews regarding the blogger lovers however this piece of writing
is actually a fastidious piece of writing, keep it up.

freight forwarder dallas -

freight forwarder dallas - freight forwarder in germany - freight forwarder fremantle - freight forwarder yorkshire - freight forwarder usa to mexico

freight forwarder jobs uk -

freight forwarder jobs uk - freight forwarder quiz - freight forwarder yaku - freight forwarder egypt - freight forwarder vat

I do not even know how I

I do not even know how I ended up here, but I thought this post was great.
I don't know who you are but certainly you're
going to a famous blogger if you aren't already ;) Cheers!

freight forwarder quiz -

freight forwarder quiz - freight forwarder zimbabwe - freight forwarder zurich - freight forwarder translate - freight forwarder recruitment agencies

My brother suggested I might

My brother suggested I might like this website.
He was entirely right. This post truly made my day. You can not imagine simply how much time I
had spent for this info! Thanks!

My brother recommended I

My brother recommended I might like this blog. He was entirely right.
This publish truly made my day. You cann't believe simply
how much time I had spent for this information! Thank you!

freight forwarder wordpress

freight forwarder wordpress theme - freight forwarder portland oregon - freight forwarder san diego - freight forwarder kolkata - freight forwarder settlement

freight forwarder traduction

freight forwarder traduction - freight forwarder portugal - freight forwarder que es - freight forwarder rates - freight forwarder spain

I'm really loving the

I'm really loving the theme/design of your web site. Do you ever run into
any web browser compatibility problems? A number of my blog audience
have complained about my website not operating correctly
in Explorer but looks great in Opera. Do you have any recommendations to
help fix this issue?

freight forwarder kota

freight forwarder kota kinabalu - freight forwarder quotation sample - freight forwarder washington dc - freight forwarder hong kong to philippines - freight forwarder to uk

freight forwarder penang -

freight forwarder penang - freight forwarder a-z - freight forwarder kuala lumpur - freight forwarder presentation - freight forwarder zimbabwe

Your mode of describing

Your mode of describing everything in this article
is really nice, all be capable of effortlessly be aware of it, Thanks a lot.

freight forwarder seattle -

freight forwarder seattle - freight forwarder business for sale - freight forwarder greece - freight forwarder china to thailand - freight forwarder nvocc

freight forwarder - freight

freight forwarder - freight forwarder yokohama - famous freight forwarding (thailand) co. ltd - freight forwarder in mumbai - freight forwarder hiring in paranaque

I'm not sure exactly why but

I'm not sure exactly why but this site is loading extremely slow
for me. Is anyone else having this issue or is it
a problem on my end? I'll check back later and see if the problem still exists.

My brother recommended I

My brother recommended I might like this website. He used to be entirely
right. This put up actually made my day. You cann't believe
just how so much time I had spent for this information! Thanks!

freight forwarder kansas city

freight forwarder kansas city - freight forwarder new york city - freight forwarder uk - freight forwarder oakville - freight forwarder zimbabwe

freight forwarder for amazon

freight forwarder for amazon fba - freight forwarder kolkata - freight forwarder shipping - freight forwarder in spanish - freight forwarder quora

I blog frequently and I

I blog frequently and I seriously thank you for your
content. This article has truly peaked my
interest. I am going to book mark your site and keep checking for new details about once per week.
I opted in for your RSS feed as well.

freight forwarder in yokohama

freight forwarder in yokohama japan - freight forwarder jobs in delhi - freight forwarder association thailand - freight forwarder nvocc - freight forwarder what do they do

I do accept as true with all

I do accept as true with all the ideas you have offered in your post.
They are very convincing and can definitely work. Nonetheless, the posts are
very quick for starters. Could you please lengthen them
a little from subsequent time? Thank you for the post.

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.