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.
  • 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 could certainly see your

You could certainly see your expertise within the work you write.
The sector hopes for even more passionate writers like you
who are not afraid to say how they believe.
All the time follow your heart.

You're so awesome! I don't

You're so awesome! I don't suppose I've read through a single thing like this before.
So good to discover someone with original thoughts on this topic.
Seriously.. thank you for starting this up. This web site
is something that's needed on the internet, someone with some originality!

Because the admin of this web

Because the admin of this web site is working, no hesitation very
shortly it will be famous, due to its quality contents.

Great post. I was checking

Great post. I was checking constantly this weblog and I am impressed!
Very useful info particularly the final phase :) I care for such info a lot.
I used to be seeking this certain info for a very lengthy time.
Thanks and best of luck.

I do believe all the ideas

I do believe all the ideas you've introduced for your post. They're really convincing and will certainly work. Nonetheless, the posts are too quick for starters. May you please extend them a little from subsequent time? Thanks for the post.|

Great article, just what I

Great article, just what I was looking for.

I all the time emailed this

I all the time emailed this blog post page to all my contacts, for the reason that if like to read it next my contacts will too.

Hi! This post could not be

Hi! This post could not be written any better!
Reading through this post reminds me of my old room mate!
He always kept talking about this. I will forward this page to
him. Fairly certain he will have a good read.
Thank you for sharing!

Oh my goodness! Incredible

Oh my goodness! Incredible article dude! Thanks, However I am encountering difficulties with your RSS.
I don't know why I cannot subscribe to it. Is there anybody else
having identical RSS problems? Anyone who knows the solution will you kindly respond?
Thanks!!

I was recommended this web

I was recommended this web site by my cousin. I'm not sure whether this post is written by him as no one else know such detailed about my trouble.
You're wonderful! Thanks!

Valuable information. Lucky

Valuable information. Lucky me I discovered your web site unintentionally, and I'm shocked
why this accident didn't came about earlier! I bookmarked it.

I quite like looking through

I quite like looking through a post that will make people think.
Also, thank you for allowing for me to comment!

It is appropriate time to

It is appropriate time to make some plans for the future and it is time to be happy. I have read this post and if I could I desire to suggest you some interesting things or tips. Perhaps you could write next articles referring to this article. I wish to read even more things about it!|

I'm really impressed with

I'm really impressed with your writing skills and also with the layout on your blog.
Is this a paid theme or did you customize it yourself?
Either way keep up the nice quality writing, it's rare to see a nice blog like this one these days.

It's appropriate time to make

It's appropriate time to make some plans for the longer term and it is time to be happy.
I have read this publish and if I may just I want to counsel you some
fascinating issues or advice. Perhaps you can write subsequent articles relating
to this article. I want to learn more issues approximately it!

It's enormous that you are

It's enormous that you are getting thoughts from this piece of writing
as well as from our discussion made here.

At this time it looks like

At this time it looks like BlogEngine is the preferred blogging platform
out there right now. (from what I've read) Is that what you're using on your blog?

Hi, I do believe this is a

Hi, I do believe this is a great site. I stumbledupon it ;
) I will return yet again since i have saved as a favorite it.
Money and freedom is the best way to change, may
you be rich and continue to help other people.

Excellent blog here! Also

Excellent blog here! Also your site so much up fast! What host are you the usage of?
Can I am getting your affiliate link on your host?
I want my web site loaded up as quickly as yours lol

Simply want to say your

Simply want to say your article is as astounding.

The clearness to your put up is simply spectacular and that i can assume you're a
professional in this subject. Well with your permission let me to
clutch your feed to keep updated with drawing close post.
Thanks one million and please carry on the rewarding work.

I was able to find good

I was able to find good advice from your content.

Hello, always i used to check

Hello, always i used to check webpage posts here
early in the daylight, for the reason that i love to learn more and more.

I'm impressed, I must say.

I'm impressed, I must say. Seldom do I come across a blog that's both educative and engaging, and
let me tell you, you've hit the nail on the head.
The issue is something which not enough men and women are speaking intelligently about.
I am very happy that I came across this during my hunt for something concerning this.

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 could do with a few pics to drive the message home a bit,
but other than that, this is magnificent blog. A fantastic read.

I'll certainly be back.

For latest information you

For latest information you have to pay a quick visit world wide web and on the web I found this web site as a best site
for latest updates.

Thanks very nice blog!

Thanks very nice blog!

Hey There. I found your blog

Hey There. I found your blog using msn. This is a really well written article.
I'll be sure to bookmark it and return to read more of your useful info.

Thanks for the post. I will definitely return.

Spot on with this write-up, I

Spot on with this write-up, I actually believe that this site needs far
more attention. I'll probably be returning to see more,
thanks for the information!

Hello would you mind sharing

Hello would you mind sharing which blog platform you're
working with? I'm planning to start my own blog in the near
future but I'm having a tough time making a decision 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!

Asking questions are really

Asking questions are really fastidious thing if you are not understanding
something completely, except this article provides good understanding
even.

hello!,I really like your

hello!,I really like your writing very so much! proportion we keep up a correspondence more approximately your article on AOL?
I require an expert on this space to resolve my
problem. May be that's you! Taking a look ahead to see you.

Hello, Neat post. There's an

Hello, Neat post. There's an issue along with your site in internet explorer, may check this?
IE still is the marketplace chief and a good component to other folks will omit
your wonderful writing due to this problem.

I used to be suggested this

I used to be suggested this blog by means of my cousin. I'm not positive whether this post is written by
way of him as nobody else recognise such precise approximately
my trouble. You are wonderful! 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. Anyway, just wanted to say great blog!

Excellent way of describing,

Excellent way of describing, and pleasant post to take data concerning my
presentation topic, which i am going to present in school.

Wonderful beat ! I would like

Wonderful beat ! I would like 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 tiny bit acquainted of this your
broadcast offered bright clear concept

whoah this blog is wonderful

whoah this blog is wonderful i really like studying your articles.

Keep up the great work! You realize, lots of people are searching round for this info,
you could aid them greatly.

It's in fact very difficult

It's in fact very difficult in this busy life to
listen news on TV, therefore I simply use internet for that purpose, and take the latest information.

Highly descriptive blog, I

Highly descriptive blog, I loved that a lot. Will there be
a part 2?

Hello, its pleasant article

Hello, its pleasant article about media print, we all be familiar with media
is a enormous source of information.

Hi my loved one! I wish to

Hi my loved one! I wish to say that this post is awesome, nice
written and include almost all vital infos. I
would like to peer extra posts like this .

Thanks for a marvelous

Thanks for a marvelous posting! I seriously enjoyed reading it, you could be a great author.
I will be sure to bookmark your blog and may come back
later in life. I want to encourage you to continue your great job, have a nice afternoon!

We are a group of volunteers

We are a group of volunteers and opening a new scheme in our community.
Your web site offered us with valuable information to work on. You've done an impressive
task and our whole group might be thankful to you.

Great post. I will be dealing

Great post. I will be dealing with many of these issues as well..

naturally like your website

naturally like your website but you need to take a look at the spelling on several
of your posts. Several of them are rife with spelling
issues and I find it very troublesome to inform the
truth however I'll definitely come back again.

Very rapidly this website

Very rapidly this website will be famous among all blogging users, due
to it's fastidious articles or reviews

I am in fact happy to glance

I am in fact happy to glance at this weblog posts which consists of tons of
valuable information, thanks for providing such information.

Hi there! I know this is

Hi there! I know this is somewhat off topic but I
was wondering which blog platform are you using for
this website? I'm getting tired of Wordpress because I've had issues with hackers and I'm looking at
alternatives for another platform. I would be great if
you could point me in the direction of a good platform.

Right now it appears like

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

I have been exploring for a

I have been exploring for a little for any high-quality articles or weblog posts in this sort of space .
Exploring in Yahoo I eventually stumbled upon this website.
Studying this info So i am happy to express that I've a very excellent uncanny
feeling I discovered just what I needed. I most surely will make sure to do
not omit this site and give it a glance regularly.

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.