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

You actually make it seem

You actually make it seem really easy together with your presentation but I find this matter to be really one thing that
I believe I'd never understand. It kind of feels too complicated and very wide
for me. I am having a look forward on your subsequent submit, I'll attempt to get the cling of it!

I am actually thankful to the

I am actually thankful to the owner of this web site who has
shared this fantastic piece of writing at at this time.

Link exchange is nothing else

Link exchange is nothing else however it is only placing the other person's website link on your page at
proper place and other person will also do same in favor of you.

This is true for investment

This is true for investment recommendation as well.

What's up i am kavin, its my

What's up i am kavin, its my first time to commenting
anywhere, when i read this post i thought i could also make comment due to this sensible paragraph.

Traders do pay direct and

Traders do pay direct and oblique prices.

Great blog here! Additionally

Great blog here! Additionally your web site so much up very fast!
What web host are you the use of? Can I get your affiliate link to your host?
I wish my web site loaded up as fast as yours lol

Schwab Intelligent Portfolios

Schwab Intelligent Portfolios invests in Schwab
ETFs.

Hello there, I found your

Hello there, I found your site via Google while searching for a comparable topic, your website came up, it seems
good. I have bookmarked it in my google bookmarks.

Hi there, simply was aware of your weblog via Google, and found that it's really informative.
I am going to watch out for brussels. I'll be grateful should you continue this in future.

Numerous other folks will be benefited from your writing.
Cheers!

And this is an investment

And this is an investment risk worth taking.

This website was... how do I

This website was... how do I say it? Relevant!! Finally I have found something which helped me.
Many thanks!

Hi to every one, the contents

Hi to every one, the contents present at this web page are truly awesome for people
knowledge, well, keep up the nice work fellows.

Howdy! Do you know if they

Howdy! Do you know if they make any plugins to safeguard against hackers?
I'm kinda paranoid about losing everything I've worked hard on. Any tips?

Schwab Intelligent Portfolios

Schwab Intelligent Portfolios invests in Schwab ETFs.

Every weekend i used to visit

Every weekend i used to visit this website, as i wish for enjoyment, for
the reason that this this web page conations truly fastidious funny stuff too.

Now it is time to decide your

Now it is time to decide your specific investments.

Now it is time to choose your

Now it is time to choose your particular investments.

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 great posts and I feel I would be a good asset.

If you ever want to take some of the load off,
I'd love to write some material for your blog in exchange for a link
back to mine. Please send me an e-mail if interested. Kudos!

Great information. Lucky me I

Great information. Lucky me I ran across your website
by accident (stumbleupon). I have saved as a favorite for later!

A financial advisor is your

A financial advisor is your planning partner.

It's impressive that you are

It's impressive that you are getting thoughts from this piece of
writing as well as from our dialogue made at this place.

A monetary advisor is your

A monetary advisor is your planning associate.

You could definitely see your

You could definitely see your expertise within the work you write.

The world hopes for more passionate writers like you who are not afraid to say how they believe.
Always follow your heart.

Great web site you've got

Great web site you've got here.. It's hard to find high-quality writing
like yours nowadays. I truly appreciate individuals like you!
Take care!!

You need to be a part of a

You need to be a part of a contest for one of the best websites on the net.
I will highly recommend this web site!

Have you ever considered

Have you ever considered about adding a little bit more than just your articles?
I mean, what you say is valuable and everything.
Nevertheless just imagine if you added some great visuals or video clips to
give your posts more, "pop"! Your content is excellent but with images and clips, this
blog could definitely be one of the greatest in its niche.
Superb blog!

When someone writes an post

When someone writes an post he/she retains the plan of a user in his/her
mind that how a user can know it. Therefore that's why this post is perfect.
Thanks!

Wow that was strange. I just

Wow that was strange. I just wrote an extremely long comment but after I clicked submit my comment didn't show up.
Grrrr... well I'm not writing all that over again. Anyways, just wanted to say superb blog!

All types of investments

All types of investments include sure dangers.

I've been surfing on-line

I've been surfing on-line more than 3 hours nowadays,
yet I never discovered any fascinating article like yours.
It's pretty worth enough for me. In my opinion, if all website owners
and bloggers made excellent content as you probably did, the web will likely be much more useful than ever before.

We stumbled over here by a

We stumbled over here by a different page and thought
I may as well check things out. I like what I see so now i'm following you.
Look forward to checking out your web page again.

All varieties of investments

All varieties of investments come with certain dangers.

Hello to all, how is

Hello to all, how is everything, I think every one is getting more
from this site, and your views are pleasant in support of new visitors.

If you would like to increase

If you would like to increase your knowledge simply keep visiting this site and be updated with the latest
gossip posted here.

whoah this blog is great i

whoah this blog is great i love reading your articles.
Stay up the good work! You already know, a lot of individuals are looking round for this info, you can help them greatly.

Hello I am so delighted I

Hello I am so delighted I found your weblog,
I really found you by mistake, while I was searching on Google for something else, Anyways I am here now and
would just like to say thank you for a marvelous post and
a all round entertaining blog (I also love the theme/design), I don't have time to read it all
at the moment but I have saved it and also added in your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the fantastic job.

Hello my loved one! I want to

Hello my loved one! I want to say that this post is amazing, great written and include
almost all important infos. I would like to peer extra posts like this .

Schwab Clever Portfolios

Schwab Clever Portfolios invests in Schwab ETFs.

Hi there would you mind

Hi there would you mind stating which blog platform you're using?

I'm looking to start my own blog soon but I'm having a tough time choosing between BlogEngine/Wordpress/B2evolution and Drupal.

The reason I ask is because your design and style seems different then most blogs and I'm looking
for something completely unique.
P.S My apologies for getting off-topic but I had to ask!

Contemplate investments that

Contemplate investments that offer immediate annuities.

Heya! I understand this is

Heya! I understand this is sort of off-topic but I had
to ask. Does managing a well-established website such as yours take a massive amount work?
I am completely new to running a blog but I do write
in my journal everyday. I'd like to start a blog so I can share my personal experience
and views online. Please let me know if you have any kind of
recommendations or tips for brand new aspiring bloggers.

Appreciate it!

A financial advisor is your

A financial advisor is your planning associate.

I was able to find good

I was able to find good information from your blog posts.

I really like it when folks

I really like it when folks come together and share ideas.
Great blog, stick with it!

This piece of writing is in

This piece of writing is in fact a good one it helps new the
web viewers, who are wishing in favor of blogging.

Oh my goodness! Impressive

Oh my goodness! Impressive article dude! Thank you so much, However I am experiencing problems with your RSS.
I don't know the reason why I can't join it. Is there anybody having identical RSS issues?

Anyone that knows the answer will you kindly respond? Thanks!!

Think about investments that

Think about investments that offer rapid annuities.

This piece of writing gives

This piece of writing gives clear idea designed for the new viewers of blogging, that truly how
to do blogging.

I visit daily a few blogs and

I visit daily a few blogs and blogs to read posts, except this webpage provides quality based posts.

Thanks for a marvelous

Thanks for a marvelous posting! I certainly enjoyed reading it, you will be a great author.
I will be sure to bookmark your blog and will eventually come back later on. I want to encourage you continue your great posts,
have a nice day!

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.