Skip to content

Instantly share code, notes, and snippets.

@jfitzsimmons2
Last active March 23, 2018 01:11
Show Gist options
  • Save jfitzsimmons2/f568e6e5ec7c311e01c82cb144539dd8 to your computer and use it in GitHub Desktop.
Save jfitzsimmons2/f568e6e5ec7c311e01c82cb144539dd8 to your computer and use it in GitHub Desktop.
function paragraphs_pages_classy_paragraphs_list_options($options, $field, $instance) {
if ($instance['field_name'] === 'field_background_options') {
$options['bg-lg'] = t('Light gray background (soft)');
$options['bg-gr'] = t('Green background (strong)');
$options['bg-ye'] = t('Gold background (loud)');
}
if ($instance['field_name'] === 'field_spacing_options') {
$options['mv5'] = t('Add vertical margin');
$options['mb5'] = t('Add margin bottom');
$options['mt5'] = t('Add margin top');
}
if ($instance['field_name'] === 'field_variations') {
if ($instance['bundle'] === 'small_feature') {
$options['center'] = t('Center text');
$options['right'] = t('Right side');
$options['img-right'] = t('Image on right side');
}
if ($instance['bundle'] === 'button') {
$options['btn-green'] = t('Green');
$options['btn-white'] = t('Light');
$options['btn-arrow'] = t('Text with arrow');
}
}
return $options;
}
/**
* Implements hook_theme().
*/
function paragraphs_pages_theme($existing, $type, $theme, $path) {
$theme = array();
$theme['paragraphs_item__small_feature'] = array(
'render element' => 'content',
'base hook' => 'entity',
'template' => 'paragraphs-item--small-feature',
'path' => drupal_get_path('module', 'paragraphs_pages') . '/templates',
);
$theme['paragraphs_item__full_width_section_container'] = array(
'render element' => 'content',
'base hook' => 'entity',
'template' => 'paragraphs-item--full-width-section-container',
'path' => drupal_get_path('module', 'paragraphs_pages') . '/templates',
);
$theme['paragraphs_item__button'] = array(
'render element' => 'content',
'base hook' => 'entity',
'template' => 'paragraphs-item--button',
'path' => drupal_get_path('module', 'paragraphs_pages') . '/templates',
);
return $theme;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment