diff --git a/modules/fpp_entity/fpp_entity.info b/modules/fpp_entity/fpp_entity.info new file mode 100644 index 0000000..44481ba --- /dev/null +++ b/modules/fpp_entity/fpp_entity.info @@ -0,0 +1,6 @@ +name = "Fieldable Panels Panes Entity API Integration" +description = "Uses Entity API to expose extra features such as additional tokens." +package = "Panels" +core = "7.x" +dependencies[] = "fieldable_panels_panes" +dependencies[] = "entity" diff --git a/modules/fpp_entity/fpp_entity.module b/modules/fpp_entity/fpp_entity.module new file mode 100644 index 0000000..c978ab1 --- /dev/null +++ b/modules/fpp_entity/fpp_entity.module @@ -0,0 +1,73 @@ + t('Fieldable Panel Pane ID'), + 'type' => 'integer', + 'description' => t('The unique ID of the Fieldable Panel Pane.'), + 'schema field' => 'fpid', + ); + $properties['title'] = array( + 'label' => t('Title'), + 'description' => t('The title of the Fieldable Panel Pane.'), + 'setter callback' => 'entity_property_verbatim_set', + 'schema field' => 'title', + ); + $properties['admin_title'] = array( + 'label' => t('Administration title'), + 'description' => t('The admin title of the Fieldable Panel Pane.'), + 'setter callback' => 'entity_property_verbatim_set', + 'schema field' => 'admin_title', + // Question! Should this be set to required? + //'required' => TRUE, + ); + $properties['path_raw'] = array( + 'label' => t('Path raw'), + 'description' => t('The title\'s path value.'), + 'setter callback' => 'entity_property_verbatim_set', + 'schema field' => 'path', + 'type' => 'uri', + ); + $properties['path'] = array( + 'label' => t('URL'), + 'description' => t('The URL the title should link to.'), + 'getter callback' => 'fpp_entity_metadata_fpp_get_properties', + 'type' => 'uri', + 'computed' => TRUE, + ); + + return $info; +} + +/** + * Entity property callback for Fieldable Panels Pane. + */ +function fpp_entity_metadata_fpp_get_properties($entity, array $options, $name, $entity_type) { + if ($name == 'path') { + return url($entity->path); + } +} + +/** + * @} End of "ingroup fieldable_panels_panes". + */