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

Hi! I just wish to offer you

Hi! I just wish to offer you a big thumbs up for your excellent info
you have right here on this post. I'll be returning to your web site for more
soon.

You made some really good

You made some really good points there. I checked on the web to find out more about the issue and
found most people will go along with your views on this
site.

I needed to thank you for

I needed to thank you for this good read!! I absolutely loved every little bit
of it. I have got you bookmarked to look at new stuff you post…

Hey this is kinda of off

Hey this is kinda of off topic but I was wondering if
blogs use WYSIWYG editors or if you have to manually code
with HTML. I'm starting a blog soon but have no coding experience so I wanted to get
guidance from someone with experience. Any help would
be greatly appreciated!

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 do not know who you are but definitely you are
going to a famous blogger if you aren't already ;) Cheers!

My brother recommended I

My brother recommended I might like this website. He was entirely right.

This post truly made my day. You can not imagine just how much time I had spent for this
information! Thanks!

Wow, awesome blog layout! How

Wow, awesome blog layout! How long have you been blogging for?
you made blogging look easy. The overall look of your site
is excellent, let alone the content!

If you are going for most

If you are going for most excellent contents like I do, simply pay a quick visit this web site every day for the reason that it offers feature
contents, thanks

Hi, after reading this

Hi, after reading this awesome paragraph i am too happy to share my familiarity here
with mates.

I'm not sure exactly why but

I'm not sure exactly why but this blog is loading very 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.

Aw, this was a really good

Aw, this was a really good post. Spending some time and actual effort
to make a great article… but what can I say… I hesitate a whole lot and never manage to get nearly anything done.

I got this site from my pal

I got this site from my pal who told me on the topic
of this website and at the moment this time I am visiting this site and reading very informative articles at this place.

It's awesome to go to see

It's awesome to go to see this site and
reading the views of all mates on the topic of
this piece of writing, while I am also zealous of getting familiarity.

My family members always say

My family members always say that I am wasting
my time here at web, but I know I am getting experience daily by reading such nice
posts.

Aw, this was an exceptionally

Aw, this was an exceptionally nice post. Taking a few minutes and actual
effort to create a very good article… but what can I say… I procrastinate a whole lot and don't
manage to get anything done.

Quality articles or reviews

Quality articles or reviews is the crucial to attract
the visitors to pay a visit the website, that's what this website is providing.

WOW just what I was looking

WOW just what I was looking for. Came here by searching
for medical doctor

Very nice post. I just

Very nice post. I just stumbled upon your blog and wished to
say that I have truly enjoyed browsing your weblog posts.
In any case I'll be subscribing on your feed and I hope you write once more soon!

Have you ever considered

Have you ever considered about including a little bit more than just your articles?
I mean, what you say is fundamental and everything.
But think of if you added some great images or videos to
give your posts more, "pop"! Your content is excellent but with pics and videos,
this site could certainly be one of the most beneficial in its field.

Great blog!

Thanks designed for sharing

Thanks designed for sharing such a nice
opinion, piece of writing is pleasant, thats why i have read it completely

These are really great ideas

These are really great ideas in regarding blogging.
You have touched some good things here. Any way keep up
wrinting.

My partner and I stumbled

My partner and I stumbled over here different
web page and thought I may as well check things out.
I like what I see so now i am following you. Look forward to
looking at your web page for a second time.

I think everything posted

I think everything posted made a great deal of sense.
But, what about this? suppose you were to
create a killer title? I am not suggesting your content isn't good.,
but what if you added a post title to possibly get a person's attention?
I mean Válasz a hozzászólásra is kinda vanilla.

You ought to look at Yahoo's front page and note how they create news titles to grab
people to open the links. You might try adding a video or a pic or two to
grab people interested about everything've got to
say. Just my opinion, it might bring your posts
a little livelier.

Great delivery. Sound

Great delivery. Sound arguments. Keep up the great
work.

Undeniably believe that which

Undeniably believe that which you said. Your favorite justification appeared to be on the net the simplest thing to be
aware of. I say to you, I definitely get annoyed while people think about worries that they just don't know about.
You managed to hit the nail upon the top as well as defined out the
whole thing without having side-effects , people could take a signal.
Will likely be back to get more. Thanks

Hello I am so excited I found

Hello I am so excited I found your blog, I really found
you by error, while I was researching on Askjeeve for something else, Nonetheless I am
here now and would just like to say many thanks for a fantastic post and a all
round interesting blog (I also love the theme/design), I don’t
have time to look over it all at the moment but I
have bookmarked it and also added your RSS feeds, so
when I have time I will be back to read more, Please do keep up the great jo.

First off I would like to say

First off I would like to say wonderful blog!
I had a quick question that I'd like to ask if you don't mind.
I was curious to know how you center yourself and clear your head before writing.
I've had difficulty clearing my mind in getting my thoughts out there.

I do take pleasure in writing but it just seems like the first 10 to 15 minutes
are generally wasted simply just trying to figure out
how to begin. Any recommendations or hints? Thanks!

It's not my first time to go

It's not my first time to go to see this website, i am browsing this web
page dailly and get pleasant facts from here every day.

I believe everything

I believe everything published was actually very reasonable.
But, what about this? what if you added a little
information? I mean, I don't want to tell you how to run your website,
however suppose you added something that grabbed folk's
attention? I mean Válasz a hozzászólásra is kinda plain.
You could look at Yahoo's home page and watch how they create article titles to grab people interested.
You might add a related video or a related picture or two to grab people excited about everything've
written. In my opinion, it could bring your website a little bit more interesting.

I would like to thank you for

I would like to thank you for the efforts you have put in penning this blog.

I am hoping to check out the same high-grade blog posts from
you later on as well. In fact, your creative writing abilities has motivated me to get my very own site now ;)

Great delivery. Solid

Great delivery. Solid arguments. Keep up the amazing spirit.

Hey this is kind of of off

Hey this is kind of of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I'm starting a blog soon but have no coding know-how so I wanted to get advice from someone with experience. Any help would be enormously appreciated!

What i don't understood is in

What i don't understood is in reality how you're no longer actually much more smartly-favored than you may be now.

You are very intelligent. You recognize thus considerably on the subject of this subject, produced me for my part believe it from
numerous numerous angles. Its like women and men are not involved until it's one thing
to accomplish with Lady gaga! Your individual
stuffs outstanding. At all times handle it up!

Wow, marvelous blog layout!

Wow, marvelous blog layout! How long have you been blogging
for? you make blogging look easy. The overall look of your site is magnificent, as well as the content!

Every weekend i used to pay a

Every weekend i used to pay a quick visit this web site, because
i wish for enjoyment, for the reason that this this website conations
in fact fastidious funny stuff too.

I relish, lead to I

I relish, lead to I discovered exactly what I used to be taking a look for.
You've ended my four day long hunt! God Bless you man.
Have a nice day. Bye

Tremendous things here. I am

Tremendous things here. I am very glad to peer your article.

Thank you so much and I'm taking a look ahead to touch you.
Will you please drop me a mail?

I believe this is one of the

I believe this is one of the so much important info for me.
And i'm glad studying your article. But should remark on few general issues, The site taste
is perfect, the articles is really great : D. Good activity, cheers

Howdy! This blog post

Howdy! This blog post couldn't be written any better!

Going through this article reminds me of my previous roommate!
He always kept preaching about this. I am going to send this
information to him. Pretty sure he's going to have a great
read. I appreciate you for sharing!

I constantly spent my half an

I constantly spent my half an hour to read this website's posts daily along
with a mug of coffee.

bookmarked!!, I like your

bookmarked!!, I like your blog!

box cialis manufacturer

box cialis manufacturer coupon 2020 largely
biological [url=https://getcialistabsfasty.com/]cialis manufacturer coupon 2020[/url] sudden https://getcialistabsfasty.com/

Hello there, just became

Hello there, just became aware of your blog through Google,
and found that it is really informative. I'm going to watch out for brussels.
I'll be grateful if you continue this in future. Lots
of people will be benefited from your writing. Cheers!

Great beat ! I wish to

Great beat ! I wish to apprentice whilst you amend your
site, how could i subscribe for a weblog web site? The account helped me
a applicable deal. I were a little bit familiar of this your broadcast provided vibrant clear idea

What a information of

What a information of un-ambiguity and preserveness of precious experience about unexpected feelings.

It's going to be finish of

It's going to be finish of mine day, but before finish
I am reading this enormous article to improve my experience.

Greate pieces. Keep posting

Greate pieces. Keep posting such kind of information on your blog.
Im really impressed by your blog.
Hi there, You've done an excellent job. I'll certainly digg
it and personally recommend to my friends.
I am confident they will be benefited from this
web site.

What's up, just wanted to

What's up, just wanted to mention, I liked this
article. It was helpful. Keep on posting!

What's up i am kavin, its my

What's up i am kavin, its my first occasion to commenting anyplace, when i read this piece of writing
i thought i could also create comment due to this good
post.

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.