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

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.

Hi there, this weekend is

Hi there, this weekend is fastidious in support of me, because this point in time i am
reading this great educational piece of writing here
at my home.

I am not sure where you are

I am not sure where you are getting your information, but good topic.
I needs to spend some time learning much more
or understanding more. Thanks for great info I was looking for this information for my mission.

It's amazing in favor of me

It's amazing in favor of me to have a web site, which is useful
for my experience. thanks admin

Appreciate the

Appreciate the recommendation. Let me try it out.

This is a very good tip

This is a very good tip especially to those fresh to the
blogosphere. Short but very precise information… Thank you for sharing this one.
A must read article!

This post will assist the

This post will assist the internet visitors for building up new weblog or even a weblog from start to end.|

Greetings! Very useful advice

Greetings! Very useful advice within this post!

It is the little changes that produce the most important changes.
Many thanks for sharing!

I'm truly enjoying the design

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

Hello, I wish for to

Hello, I wish for to subscribe for this blog to obtain hottest updates, therefore where can i do it please
assist.

Asking questions are really

Asking questions are really good thing if you are not understanding anything entirely, however
this piece of writing provides good understanding yet.

My programmer is trying to

My programmer is trying to persuade me to move to .net from PHP.
I have always disliked the idea because of the costs.
But he's tryiong none the less. I've been using Movable-type on a variety of websites for
about a year and am worried about switching to another
platform. I have heard great things about blogengine.net. Is
there a way I can import all my wordpress posts into it?
Any help would be greatly appreciated!

Do you mind if I quote a few

Do you mind if I quote a few of your posts as
long as I provide credit and sources back to your
webpage? My blog site is in the exact same area of interest
as yours and my users would really benefit from some of the information you provide here.
Please let me know if this okay with you. Cheers!

I think the admin of this web

I think the admin of this web site is genuinely working hard in support of his website, because here every material is quality based data.

Hello! Someone in my Facebook

Hello! Someone in my Facebook group shared this site with us so I came to check it out.

I'm definitely enjoying the information. I'm bookmarking and will be
tweeting this to my followers! Terrific blog and
wonderful style and design.

Definitely believe that which

Definitely believe that which you stated. Your favorite reason seemed to be on the web the simplest thing to be
aware of. I say to you, I certainly get annoyed while people consider
worries that they plainly don't know about.

You managed to hit the nail upon the top and also defined
out the whole thing without having side effect , people
can take a signal. Will probably be back to get more.
Thanks

Hiya! Quick question that's

Hiya! Quick question that's totally off topic.

Do you know how to make your site mobile friendly?

My weblog looks weird when viewing from my iphone 4. I'm trying to find a template or plugin that
might be able to fix this issue. If you have any recommendations, please share.
Cheers!

Wow, superb blog layout! How

Wow, superb blog layout! How long have you been blogging for?

you made blogging look easy. The overall look of your site is wonderful, as well as the content!

I was able to find good

I was able to find good advice from your content.

I used to be able to find

I used to be able to find good advice from your blog articles.

Hi Dear, are you truly

Hi Dear, are you truly visiting this web page regularly, if so afterward you will without doubt
take fastidious know-how.

It's awesome to visit this

It's awesome to visit this web page and reading the views of all friends on the topic of this article, while I am also zealous of getting
familiarity.

This site really has all of

This site really has all of the information I wanted about this
subject and didn't know who to ask.

It's perfect time to make

It's perfect time to make some plans for the future and it's time to be happy.
I've read this post and if I could I wish to suggest you some interesting things or suggestions.

Perhaps you could write next articles referring to this article.
I wish to read even more things about it!

This is a good tip

This is a good tip particularly to those new to the blogosphere.

Short but very accurate info… Many thanks for sharing this one.
A must read post!

It is not my first time to

It is not my first time to visit this site, i am visiting
this web page dailly and take nice information from here all the time.

I'll right away clutch your

I'll right away clutch your rss as I can not in finding your e-mail subscription hyperlink or newsletter
service. Do you've any? Kindly allow me know in order that I may just subscribe.

Thanks.

grassroots kratom buy kratom

grassroots kratom buy kratom online k kratom [url=http://kratomsaleusa.com/#]kratom
capsules[/url] can you buy kratom in stores where to
buy kratom http://kratomsaleusa.com/

I quite like reading through

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

Hey there terrific website!

Hey there terrific website! Does running a blog such
as this require a lot of work? I've no expertise in coding however I had been hoping to start my own blog soon. Anyway, should you have any
recommendations or techniques for new blog owners please share.

I know this is off topic however I simply wanted
to ask. Many thanks!

Appreciation to my father who

Appreciation to my father who stated to me regarding this website,
this weblog is truly remarkable.

I love it when people come

I love it when people come together and share thoughts.
Great website, continue the good work!

This piece of writing gives

This piece of writing gives clear idea in support of the new visitors of blogging, that really how to do blogging and
site-building.

Paragraph writing is also a

Paragraph writing is also a excitement, if you be familiar with afterward you can write or else it is
difficult to write.

I could not refrain from

I could not refrain from commenting. Well written!

May I just say what a comfort

May I just say what a comfort to discover a person that genuinely understands what they are discussing online.
You actually understand how to bring a problem to light and
make it important. More and more people have
to look at this and understand this side of the story.
I can't believe you are not more popular since you surely possess the gift.

Hello, I think your blog

Hello, I think your blog might be having browser compatibility
issues. When I look at your website in Ie, 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, wonderful blog!

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.