function panopoly_magic_reusable_entity_validate in Panopoly 7
Validator to ensure that reusable entites have titles.
1 string reference to 'panopoly_magic_reusable_entity_validate'
- panopoly_magic_form_fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form_alter in modules/
panopoly/ panopoly_magic/ panopoly_magic.module - Implementation of hook_form_FORM_ID_alter()
File
- modules/
panopoly/ panopoly_magic/ panopoly_magic.module, line 1498
Code
function panopoly_magic_reusable_entity_validate($element, &$form_state, $form) {
// Don't validate if we're just updating the preview.
if (!empty($form_state['triggering_element']) && $form_state['triggering_element']['#value'] == 'Update Preview') {
return;
}
// If the reusable entity checkbox is selected.
if (!empty($form_state['values']['reusable'])) {
// Ensure a title is present.
if (empty($element['#value'])) {
form_error($element, t('If you would like this entity to be reusable, please add a title.'));
}
}
}