Introducción a Puppet

Ayer dí una charla introductoria a Puppet para Las Palmas DevOps.

No se pudo grabar en video. Sin embargo la presentación contiene bastante documentación, y puede servir de referencia para quien quiera introducirse en Puppet o bien profundizar o reciclar su conocimiento sobre esta herramienta si hace tiempo que no la usa.

Gracias a NITEMAN por la revisión, sugerencias y el toque artístico en las páginas 3 y 40.

Ported Maintenance Helper to Drupal 7

Maintenance Helper is a handy module to restrict login access per role. This allows to put the site in a somehow soft-maintenance status where authors are not able to post or edit contents while the site is still accesible to visitors. It is very handy to control the relocation of the site to a new server.

Ease the creation of fields and instances programatically

So you want to build a module that provides some fields and instances for an entity type. Let's start with a quick summary to get in context.

As you should know, fields in drupal are thingies that exist on its own, though they're useless if not attached to entities. Fields are tied to entities through instances. So to attach a field to a node or any other type of entity, it's needed to create instances. In this way, an instance is identified by the field name it instantiates and the entity type - bundle tuple it is tied to.

In Drupal's admin UI, creating fields and instances is overlapped: when you create a field, you're also creating an instance. On the other hand, when you're reusing an existing field, you're just creating a new instance of it.

Last but not least, part of the configuration you can see in the UI pertains to the field definition, and part to the field instance. So field configuration is the same for all of its instances, and instance configuration is specific and not shared by other instances.

How to lock/unlock a field in Drupal

Field instances provided by modules are usually locked so you can't delete them or modify structural information. An example of this is Drupal Commerce.

The field locking system in Drupal is quite poor and doesn't manage some situations where there's a legitimate need to change some field settings that won't never affect the stored data or the field's behaviour. For example you may want to unlock a field to change the field label or some widget settings.

Here's a code snippet to lock/unlock a field. It can be run quickly via devel's php block. Use it at your own risk.

$field_name = 'field_name';
$field = field_read_field($field_name);
$field['locked'] = 0; // 0: unlock; 1: lock.
field_update_field($field);

Ctools access plugin for users in a reference field

Wrote an access plugin to provide access/visiblity if a user context is present in a entityreference or user_reference field.

An example scenario where this plugin is useful is using panels' node templates to render nodes. For a content-type with a field like "authors" (users that can view/edit this node) you can add a selection rule like Logged in user is User from Node (on Node: authors [field_authors]).

Without this plugin, you can only control access in a similar manner for fields with a cardinality of one, via a relationship. This plugin introduces the possibility to check access based on a multivalued field.

Cómo ocultar el título de bloques mediante código

Estoy desarrollando una distribución Drupal. Ahora mismo ando exportando grupos de configuración a features y me encuentro con un problema que he afrontado ya varias veces sin haber encontrado (hasta ahora) una solución satisfactoria.

Uso el módulo context para gestionar la disposición de los bloques. En algunos bloques necesito que el título no se muestre, y context no proporciona una manera de hacer esto (panels si), por lo que recurro a la interfaz administrativa de bloques y neutralizo el título poniendo <none>. Quizás haya maneras de hacerlo con algún módulo que extienda context, pero por lo que he buscado y preguntado no existe otra opción.

El problema con el que me encuentro es que al exportar la configuración de context a código, el override del título del bloque no se exporta....

Display suite integration for tweetbutton & fblikebutton

I needed to add Twitter and Facebook buttons to a site. There's a lot of solutions out there, I choose these two tiny modules instead of a all-in-one full featured solution.

So I also wanted to manage them with display suite. The integration is quite simple to write, and the advantages of such an integration enormous.

Helped fix several issues in bean project

Started using Bean to provide sites with fieldable block entities. This is a great module, slowly moving towards a stable release.

Fixed several issues identified while using it. I will continue contributing due to that this module is now part of my drupal kit.

Convert taxonomy_display to use ctools objects, so become exportable with features

I needed to export taxonomy_display configuration with features. I ended providing a patch to convert its backend to use ctools object and levarage features benefits.

4 scripts para el trabajo sucio con mysql

Tras varias ocasiones en que he ofrecido a algún colega uno de estos scripts me he decidido a juntarlos todos en el mismo sitio y compartirlos formalmente. Se trata de un puñado de scripts que en el pasado implementé según me hicieron falta para resolver o cubrir alguna necesidad.

Páginas

Subscribe to Atlantic/Canary RSS