19 var
$contexts = array(
'single',
'multiple',
'export' );
24 $this->label = esc_html__(
'Gravatar',
'gk-gravityview' );
25 $this->
description = esc_html__(
'A Gravatar is an image that represents a person online based on their email. Powered by gravatar.com.',
'gk-gravityview' );
29 parent::__construct();
36 add_filter(
'gravityview_entry_default_fields', array( $this,
'add_default_field' ), 10, 3 );
50 if (
'edit' === $zone ) {
51 return $entry_default_fields;
55 'label' => $this->label,
57 'type' => $this->name,
58 'icon' =>
'dashicons-id',
61 return $entry_default_fields;
78 case 'created_by_email':
88 $email =
$user->user_email;
104 if (
'edit' === $context ) {
105 return $field_options;
108 unset( $field_options[
'new_window'] );
110 $field_options[
'email_field'] = array(
112 'label' => __(
'Email to Use',
'gk-gravityview' ),
113 'value' =>
'created_by_email',
114 'desc' => __(
'Which email should be used to generate the Gravatar?',
'gk-gravityview' ),
116 'group' =>
'display',
119 $field_options[
'default'] = array(
121 'label' => __(
'Default Image',
'gk-gravityview' ),
122 'desc' => __(
'Choose the default image to be shown when an email has no Gravatar.',
'gk-gravityview' ) .
' <a href="https://en.gravatar.com/site/implement/images/">' . esc_html( sprintf( __(
'Read more about %s',
'gk-gravityview' ), __(
'Default Image',
'gk-gravityview' ) ) ) .
'</a>',
123 'value' => get_option(
'avatar_default',
'mystery' ),
125 'mystery' => __(
'Silhouetted Person',
'gk-gravityview' ),
126 'gravatar_default' => __(
'Gravatar Icon',
'gk-gravityview' ),
127 'identicon' => __(
'Abstract Geometric Patterns',
'gk-gravityview' ),
128 'monsterid' => __(
'Monster Faces',
'gk-gravityview' ),
129 'retro' => __(
'Arcade-style Faces',
'gk-gravityview' ),
130 'robohash' => __(
'Robot Faces',
'gk-gravityview' ),
131 'blank' => __(
'Transparent Image',
'gk-gravityview' ),
133 'group' =>
'display',
136 $field_options[
'size'] = array(
138 'label' => __(
'Size in Pixels',
'gk-gravityview' ),
142 'merge_tags' =>
false,
143 'group' =>
'display',
146 return $field_options;
158 $field_choices = array(
159 'created_by_email' => __(
'Entry Creator: Email',
'gk-gravityview' ),
165 return $field_choices;
168 $email_fields = GFAPI::get_fields_by_type(
$form, array(
'email' ) );
170 foreach ( $email_fields as $email_field ) {
171 $email_field_id = $email_field[
'id'];
173 $email_field_label = sprintf( __(
'Field: %s',
'gk-gravityview' ), $email_field_label );
174 $field_choices[ $email_field_id ] = esc_html( $email_field_label );
177 return $field_choices;
Modify field settings by extending this class.
field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
new GravityView_Field_Gravatar
$field_settings['content']
if(gravityview() ->plugin->is_GF_25()) $form
add_hooks()
Add filters for this field.
static get_email( $field_settings, $entry)
Get the email address to use, based on field settings.
_get_email_field_choices( $form_id=0)
Get email fields for the form, as well as default choices.
scale description p description
if(empty( $created_by)) $form_id
static get( $array, $key, $default=null)
Grab a value from an array or an object or default.
static get_field_label( $form=array(), $field_id='', $field_value='')
Retrieve the label of a given field id (for a specific form)
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed
add_default_field( $entry_default_fields=array(), $form=array(), $zone='')
Add this field to the default fields in the GV field picker.