GithubHelp home page GithubHelp logo

decipher / customformatters.com Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 3.0 354 KB

CustomFormatters.com is an online repository of Custom Formatters snippets.

Home Page: http://customformatters.com

PHP 7.24% JavaScript 6.59% CSS 86.17%

customformatters.com's Introduction

customformatters.com's People

Contributors

decipher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

customformatters.com's Issues

Pathauto in make file twice

Thanks for making customformatters.com. It looks like it will be very handy as more formatters are added. While scanning your make file I noticed pathauto listed twice. One other thing you might want to do as a best practice in your make files is document what issue the patch files came from.

Hope that helps,
-Glenn

Drupal API template

I've just had a look at the code used in the "Drupal API" version of a formatter, in particular, the MY_MODULE_field_formatter_view function. You have the following code to assign the element:

if (function_exists($function = "{$display['module']}_field_formatter_{$display['type']}")) {
  $element[0] = array(
    '#markup' => $function($variables),
  );
}

I had to make the following change to get it to work:

if (function_exists($function = "{$display['module']}_field_formatter_{$display['type']}")) {
  $element = $function($variables);
}

cheers

Murray

Provide examples of Custom Formatters

Some sort of image preview of the results of a Custom Formatter in use is essential, otherwise there is no way of knowing what it really does unless the description is extremely clear or the users are able to understand the code.

decimal converter

OK, I have spent countless hours trying to get a custom formatter working... but I just don't have the knowledge to code this. I found a PHP snippet that does what I need it to do, but how do I use the code with CustomFormatter?

Basically I want the user to input the actual number that will be in millions, ie: 2,300,587.00 but I want it formated in certain instances as only 2.3 Million etc.

Here is the code:


1000000000000) return round(($n/1000000000000),2).' trillion'; else if($n>1000000000) return round(($n/1000000000),2).' billion'; else if($n>1000000) return round(($n/1000000),2).' million'; else if($n>1000) return round(($n/1000),2).' thousand'; return number_format($n); } ``` echo nice_number('14120000'); //14.12 million ?>

Function problem inside formatter

Hey guys,

Having a problem. I am using a custom function in a custom formatter and am receiving errors on the search results page because it is trying to redeclare the function. I have tried:

if (function_exists('myfunction') != true) {

function myfunction { ... }

}

but then I receive an error that the function is undefined. Any ideas on where I can place this function, maybe at a higher level, where it can be defined once?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.