It would be useful to add a new drop-down called "Style" to the eb image field collection.

The field called "Style" (field_eb_image_style) should use the List (text) field. The drop-down should be populated via the allowed values settings. For example (default value):

array('allowed_values' => array(
    'tile' => 'Tile',
    'repeat' => 'Repeat',
));

If repeat has been selected, then the class .eb-image-repeat should be added to the paragraph entity using JS. Site builders should be allowed to add extra items to field_eb_image_style. The selected style should be added to entity as a class: ".eb-image-[SELECTED_STYLE]"

Comments

dabbor’s picture

Issue summary: View changes
dabbor’s picture

Here's a patch with implementation.

dabbor’s picture

Status: Active » Needs review
ivan zugec’s picture

Status: Needs review » Needs work
  1. +++ b/includes/entity_background.fields_crud.inc
    @@ -323,6 +323,67 @@ function entity_background_get_field_color($field_name, $cardinality = 1) {
    +    'settings' => array(
    +      'allowed_values' => array(
    +        'tile' => 'Tile',
    +        'repeat' => 'Repeat',
    +      ),
    +      'allowed_values_function' => '',
    

    We shouldn't hard code the settings. Pass it via a variable.

  2. +++ b/module/entity_background_image/plugins/entity_background/image.inc
    @@ -21,6 +21,11 @@ $plugin = array(
    +  $style = $wrapper->field_eb_image_style->value(); // array('sanitize' => TRUE));
    

    We should sanitise the value.

  3. entity_background_get_field_image_style
    entity_background_add_field_image_style
    

    Rename the functions to:

    entity_background_get_field_list_text
    entity_background_add_field_list_text
    
dabbor’s picture

Providing new patch.

Changes:

  • Passing the "list text" field settings via variable.
  • Sanitizing the Style value.
  • Renamed the functions entity_background_get_field_image_style, entity_background_add_field_image_style to entity_background_get_field_list_text, entity_background_add_field_list_text.
  • Tested.
dabbor’s picture

Status: Needs work » Needs review

  • Ivan Zugec committed 186edee on 7.x-1.x authored by dabbor
    Issue #2468617 by dabbor: Entity background image having style drop-down
    
ivan zugec’s picture

Status: Needs review » Fixed

Thanks. It's been committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.