Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/30/2016 03:17:16 PM (9 years ago)
Author:
boonebgorges
Message:

XProfile: Introduce new settings for Datebox field type.

These new settings are designed to make it easier for site administrators
to decide how date-based data will be collected and displayed.

  • "Date format" allows the admin to select how dates will be displayed on public profiles. A number of default custom date formats are included. Admins may also enter a custom date format, or opt to display time elapsed ("4 years ago", etc).
  • "Range" allows the admin to set the start and end values for the Year dropdown. There are two ways to configure the range. The first is by defining a specific set of start and end years. The second is to define a relative range: *from* a certain number of years ago (or in the future) *to* a certain number of years ago (or in the future).

Props abwebstudio, abweb, sooskriszta, boonebgorges, DJPaul, mercime.

See #5500.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type.php

    r10828 r11041  
    8181     */
    8282    public $supports_richtext = false;
     83
     84    /**
     85     * If the field type has a type-specific settings section on the Edit Field panel.
     86     *
     87     * @since 2.7.0
     88     * @var bool|null Boolean if set explicitly by the type object, otherwise null.
     89     */
     90    protected $do_settings_section = null;
    8391
    8492    /**
     
    227235         */
    228236        return (bool) apply_filters( 'bp_xprofile_field_type_is_valid', $validated, $values, $this );
     237    }
     238
     239    /**
     240     * Check whether the current field type should have a settings ("options") section on the Edit Field panel.
     241     *
     242     * Falls back on `supports_options` if no value is set by the field type.
     243     *
     244     * @since 2.7.0
     245     *
     246     * @return bool
     247     */
     248    public function do_settings_section() {
     249        if ( null === $this->do_settings_section ) {
     250            $this->do_settings_section = $this->supports_options;
     251        }
     252
     253        return (bool) $this->do_settings_section;
    229254    }
    230255
     
    452477    }
    453478
     479    /**
     480     * Save miscellaneous settings related to this field type.
     481     *
     482     * Override in a specific field type if it requires an admin save routine.
     483     *
     484     * @since 2.7.0
     485     *
     486     * @param int   $field_id Field ID.
     487     * @param array $settings Array of settings.
     488     */
     489    public function admin_save_settings( $field_id, $settings ) {}
     490
    454491    /** Protected *************************************************************/
    455492
Note: See TracChangeset for help on using the changeset viewer.