Casiva Agustin

Engineering, Development and IT Management

Hi there! 👋

I’m Agustin Casiva, I’m a Software Engineer from Argentina.

I have been working on IT for many years now, I worked in many fields of the industry, such as hardware support, networking, sysadmin but what I do love most is development.

I have worked for many organizations, public and private, local and remote, filling many roles.

My expertise is on Web Development, Linux, Open Source, CMSs, HTML, CSS, PHP, JavaScript, Backend Development, Product Development, Project Management, Team Leading, among others.

In 2013 I have founded 42mate, a Web Development Agency focused on the design, development, maintenance of Web Apps. I still work on 42mate where I work leading development teams and scoping new projects.

Besides 42mate I also work as an independent consultant where I provide services such as

  • Development Training, for individuals or teams.
  • Architecture Design and Review.
  • Tech Advisor for non tech startup founders.
  • Tech Advisor for Digital Design Agencies.

If you are interested on my services let’s talk!

More about me

Drupal Custom Formatters

En Drupal cuando construimos un content type y añadimos fields al mismo, dependiendo el tipo de field, podemos elegir como dicha field va a mostrarse y donde se mostrará. Para seleccionar donde se mostrará y como tenemos que ir a la solapa de “Manage Display” en el editor del content type.

El orden se setea con drag an drop y dependiendo de la field podemos seleccionar como la field va a mostrarse usando un formatter. Los formaters leen el valor de la field y aplican un tema para renderizarla, el tema es que los formatters son límitados y los requerimientos no.

Si necesitamos aplicar un renderizado particular muchas veces caemos en la primera opción, editar la template, para que se muestren los valores como queremos. Una alternativa un poco mas elegante y que nos proveerá mas flexibilidad en el futuro es crear nuestros propios formatters.

Para implementar un formatter debemos utilizar los siguientes hooks.

Los fundamentales

hook_field_formatter_info : Meta Información para que podamos usar el formatter del editor.
hook_field_formatter_view : Para definir el renderizado del formatter

Los formatters pueden configurarse, estos para definir las opciones del formatter

hook_field_formatter_settings_summary : Muestra en el Manage Display, en la field, las settings.
hook_field_formatter_settings_form : Define el form de setting para la field, requiere el anterior para funcionar.

Recuerden que las settings son por cada field en el content type que usen el formatter, no son globales, y pueden variar de display a display (Default, Teaster, Etc).

Uno de yapa

hook_field_formatter_prepare_view : Para levantar mas información en la field si se necesita.

Les dejo un par de links que tienen ejemplos

http://www.failover.co/blog/drupal-7-custom-field-formatter-hooks-overview

http://www.paulbooker.co.uk/dru……-custom-drupal-field-formatter-existing-field

http://www.whenwhowhere.com/tech-blog/create-custom-field-formatter-drupal-7

https://api.drupal.org/api/drupal/modules%21field_ui%21field_ui.api….

https://api.drupal.org/api/drup…._field_formatter_view/7

https://api.drupal.org/api/dru….tion/hook_field_formatter_info/7

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*