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

Hey are using Wordpress for

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

Write more, thats all I have

Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.
You obviously know what youre talking about, why throw away your intelligence on just posting
videos to your weblog when you could be giving us something informative to
read?

I really love your website..

I really love your website.. Very nice colors & theme. Did you
make this amazing site yourself? Please reply back as I'm trying to create my own personal website and would like to find out where you got this from or what the theme is called.
Cheers!

We're trusted

We're trusted Mississauga Heating and Cooling Consultants.

Howdy! This is my first visit

Howdy! This is my first visit to your blog! We are a collection of volunteers
and starting a new project in a community in the same niche.
Your blog provided us valuable information to work on. You have done
a marvellous job!

Does your website have a

Does your website have a contact page? I'm having trouble locating
it but, I'd like to send you an email. I've got some ideas for your blog you might be interested in hearing.
Either way, great website and I look forward to seeing
it develop over time.

It's an amazing post in

It's an amazing post in support of all the web people; they will take benefit from
it I am sure.

Hello! I'm at work browsing

Hello! I'm at work browsing your blog from my new iphone!
Just wanted to say I love reading your blog and look forward to
all your posts! Keep up the fantastic work!

I am actually pleased to read

I am actually pleased to read this web site posts which
carries lots of valuable facts, thanks for providing these kinds of data.

Magnificent beat ! I would

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

Incredible! This blog looks

Incredible! This blog looks exactly like my old one!

It's on a entirely different topic but it has pretty much the same page layout and
design. Excellent choice of colors!

Hurrah, that's what I was

Hurrah, that's what I was looking for, what a material! present here at this blog,
thanks admin of this web site.

What's up, I log on to your

What's up, I log on to your blogs like every week. Your story-telling style is witty, keep it up!

Now it's time to pick your

Now it's time to pick your specific investments.

Wonderful website you have

Wonderful website you have here but I was wondering if you knew of any discussion boards that cover
the same topics talked about here? I'd really love to be a part of group where I can get feedback from
other experienced individuals that share the same interest.
If you have any recommendations, please let me know. Appreciate it!

It's difficult to find

It's difficult to find knowledgeable people
on this topic, but you sound like you know what you're talking about!
Thanks

We're a bunch of volunteers

We're a bunch of volunteers and opening a new scheme in our community.
Your web site provided us with helpful information to work on.
You've done an impressive activity and our entire group will be thankful to you.

Great info. Lucky me I

Great info. Lucky me I recently found your blog by chance
(stumbleupon). I've bookmarked it for later!

Your style is really unique

Your style is really unique in comparison to other people I have read stuff from.
I appreciate you for posting when you have the opportunity, Guess
I will just bookmark this blog.

I was able to find good info

I was able to find good info from your blog articles.

Thanks , I have just been

Thanks , I have just been searching for info about this subject for a long time and yours is the best I've came upon till now. However, what about the bottom line? Are you positive in regards to the supply?

Heya outstanding blog! Does

Heya outstanding blog! Does running a blog such as this require a
large amount of work? I have no understanding of computer programming however I had been hoping to start my own blog in the near future.

Anyhow, should you have any suggestions or techniques for new blog owners please share.
I understand this is off subject but I simply wanted to ask.
Appreciate it!

I'm truly enjoying the design

I'm truly enjoying the design and layout of your blog. It's
a very easy on the eyes which makes it much more pleasant
for me to come here and visit more often. Did you
hire out a developer to create your theme? Great work!

Unquestionably imagine that

Unquestionably imagine that which you said. Your favorite justification appeared to be
at the web the easiest factor to keep in mind of. I say to you, I definitely get irked even as other people
think about issues that they just don't realize about.
You managed to hit the nail upon the top and defined out the whole thing without having side-effects , people can take a signal.
Will likely be again to get more. Thank you

Thank you, I've just been

Thank you, I've just been searching for information approximately this subject for a long
time and yours is the best I have discovered till
now. But, what about the bottom line? Are you sure concerning
the supply?

Magnificent goods from you,

Magnificent goods from you, man. I've understand your stuff previous to and
you are just too magnificent. I actually like what you have acquired here, certainly like what you are stating and the way in which you say
it. You make it entertaining and you still take care of to keep it sensible.
I can not wait to read far more from you. This is really a tremendous web site.

I pay a visit day-to-day some

I pay a visit day-to-day some sites and information sites to read
content, however this website provides quality based posts.

Thank you for every other

Thank you for every other informative web site. The place
else may just I am getting that type of info written in such an ideal approach?
I've a challenge that I'm just now operating on, and I have
been on the glance out for such information.

You need to be a part of a

You need to be a part of a contest for one of the
most useful sites online. I most certainly will recommend this blog!

Oh my goodness! Incredible

Oh my goodness! Incredible article dude! Many thanks, However I am encountering difficulties with your RSS.
I don't understand the reason why I am unable to subscribe to it.

Is there anybody else having the same RSS problems?
Anyone that knows the answer can you kindly respond? Thanks!!

It's really a great and

It's really a great and useful piece of info. I'm satisfied that
you shared this helpful information with us. Please keep us informed like this.
Thank you for sharing.

This design is incredible!

This design is incredible! You obviously 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!) Excellent job.

I really loved what you had to say, and more than that,
how you presented it. Too cool!

Hello there, You have done a

Hello there, You have done a great job. I'll definitely digg it
and personally suggest to my friends. I am sure they'll
be benefited from this website.

Fine way of describing, and

Fine way of describing, and fastidious paragraph to take information concerning my presentation focus, which
i am going to present in academy.

Quality articles or reviews

Quality articles or reviews is the secret to attract the users to go to see the site, that's what this web site is providing.

Wow, that's what I was

Wow, that's what I was exploring for, what a material!
present here at this web site, thanks admin of
this website.

This is my first time visit

This is my first time visit at here and i am in fact happy to read all at one place.

There's definately a lot to

There's definately a lot to learn about this subject.
I really like all of the points you have made.

Hi there, I desire to

Hi there, I desire to subscribe for this weblog to take
most up-to-date updates, therefore where can i do it please assist.

Think about investments that

Think about investments that offer quick annuities.

Helpful information.

Helpful information. Fortunate me I discovered your website
accidentally, and I am surprised why this coincidence didn't took place earlier!
I bookmarked it.

Having read this I believed

Having read this I believed it was very enlightening. I appreciate you taking the time and effort to put this informative
article together. I once again find myself personally spending a
significant amount of time both reading and
leaving comments. But so what, it was still worthwhile!

I absolutely love your blog

I absolutely love your blog and find the majority of your post's to be just what I'm looking for.
Would you offer guest writers to write content in your case?
I wouldn't mind producing a post or elaborating on most of the subjects you write related to here.

Again, awesome weblog!

Wonderful blog! I found it

Wonderful blog! I found it while browsing 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!
Appreciate it

For most up-to-date

For most up-to-date information you have to pay a quick
visit internet and on world-wide-web I found this web page as a most excellent site for newest updates.

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 excellent blog! I guess 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 share this site
with my Facebook group. Chat soon!

What i don't understood is in

What i don't understood is in fact how you are now not really much more smartly-preferred than you may be
right now. You are very intelligent. You recognize
therefore significantly in relation to this subject, produced me in my view consider it from a lot
of varied angles. Its like men and women don't seem to
be interested except it's something to accomplish with Lady
gaga! Your individual stuffs excellent. Always take care of it up!

Hi, Neat post. There's an

Hi, Neat post. There's an issue together with your website in internet explorer, could
check this? IE still is the marketplace chief and a
good part of folks will miss your fantastic writing due to this problem.

Hi there just wanted to give

Hi there just wanted to give you a quick heads up and let
you know a few of the images aren't loading correctly.
I'm not sure why but I think its a linking issue.
I've tried it in two different browsers and
both show the same results.

This site was... how do you

This site was... how do you say it? Relevant!! Finally I
have found something that helped me. Kudos!

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.