Hi!

I suggest to add text field to available form elements (`type` skin property). The contents of the field should be added to the corresponding class name. This would be useful for applying complex CSS stuff like nth-child, not, content and so on.

I've got a real-life situation where i need to apply `nth-child(3n+5)` via Skinr. To introduce all possible nth-child expressions for the user, i have to generate an enormous list of Skinr options via PHP. It would be way simplier to let the user input the expression into a text field.

Comments

moonray’s picture

You can probably achieve this by adding a 'form callback' to your skin info. A simple example of how this works:

<?php
/**
 * Implements hook_skinr_skin_info().
 */
function skinr_ui_test_skinr_skin_info() {
  $skins['skinr_ui_test_custom'] = array(
    'title' => t('Custom'),
    'form callback' => 'skinr_ui_test_skinr_skinr_ui_test_custom_form',
    'group' => 'general',
    'theme hooks' => array('block__system', 'comment_wrapper__page', 'node__page'),
    'default status' => 1,
    'options' => array(
      'custom' => array(
        'class' => array('custom'),
      ),
    ),
  );
  return $skins;
}

function skinr_ui_test_skinr_skinr_ui_test_custom_form($form, $form_state, $context) {
  $form = array(
    '#type' => 'textarea',
    '#title' => t('Custom'),
    '#options' => array(
      'custom' => t('Custom'),
    ),
    '#default_value' => $context['value'],
  );
  return $form;
}
?>

Note that I haven't tested this with a textfield, and there might be issues due to your not being able to provide a list of option in the skin definition.
There's also always the 'advanced' tab which allows you to enter freeform classes.

moonray’s picture

Status: Active » Closed (won't fix)

Besides the usage example of how you could implement this, I don't believe Skinr should allow you to enter any CSS. This should be done in css files includes.
Skinr's purpose is to add CLASSes only.