. */ define( 'ACFMC_VERSION', '1.4.0' ); // What is drawn through the points ("shape") and how it is drawn ("style"), // plus its colour. All three are stored per value and all three are optional: // a value without them draws no shape at all, which is what every value saved // before this version looks like. define( 'ACFMC_DEFAULT_COLOR', '#999999' ); define( 'ACFMC_URL', plugin_dir_url( __FILE__ ) ); define( 'ACFMC_PATH', plugin_dir_path( __FILE__ ) ); /** * The shapes that can be drawn through the points, and the styles they can be * drawn in. "No shape" is the absence of the key, not a value. * * @return array */ function acfmc_shapes() { return array( 'line', 'area' ); } /** * @return array */ function acfmc_styles() { return array( 'sharp', 'smoothed', 'bbox' ); } /** * Strings the map UI needs on the JavaScript side. * * Shared by the ACF 5/6 and the legacy ACF 4 field type implementations. * * @return array */ function acfmc_l10n_strings() { return array( /* translators: %s: number of points. */ 'show_coordinates' => __( 'Edit points (%s)', 'advanced-custom-fields-multiple-coordinates' ), /* translators: %s: number of points. */ 'hide_coordinates' => __( 'Hide points (%s)', 'advanced-custom-fields-multiple-coordinates' ), /* translators: %s: position of the point in the list. */ 'remove_point' => __( 'Remove point %s', 'advanced-custom-fields-multiple-coordinates' ), 'remove_point_short' => __( 'Remove', 'advanced-custom-fields-multiple-coordinates' ), /* translators: %s: position of the point in the list. */ 'move_point' => __( 'Reorder point %s. Press the up or down arrow key to move it.', 'advanced-custom-fields-multiple-coordinates' ), 'move_point_title' => __( 'Drag to reorder, or use the arrow keys', 'advanced-custom-fields-multiple-coordinates' ), /* translators: %s: position of the point in the list. */ 'point_title' => __( 'Point %s — drag to move', 'advanced-custom-fields-multiple-coordinates' ), /* translators: %s: position of the point in the list. */ 'popup_point' => __( 'Point %s', 'advanced-custom-fields-multiple-coordinates' ), 'no_points' => __( 'No points yet. Click the map to add one.', 'advanced-custom-fields-multiple-coordinates' ), /* translators: 1: position of the point, 2: total number of points. */ 'said_added' => __( 'Point %1$s added. %2$s points in total.', 'advanced-custom-fields-multiple-coordinates' ), /* translators: 1: position of the point, 2: total number of points. */ 'said_removed' => __( 'Point %1$s removed. %2$s points in total.', 'advanced-custom-fields-multiple-coordinates' ), /* translators: %s: position of the point in the list. */ 'said_moved' => __( 'Point %s moved.', 'advanced-custom-fields-multiple-coordinates' ), /* translators: 1: old position of the point, 2: new position of the point. */ 'said_reordered' => __( 'Point %1$s is now point %2$s.', 'advanced-custom-fields-multiple-coordinates' ), /* translators: %s: total number of points. */ 'said_undone' => __( 'Undone. %s points in total.', 'advanced-custom-fields-multiple-coordinates' ), 'said_nothing_to_undo' => __( 'Nothing to undo.', 'advanced-custom-fields-multiple-coordinates' ), /* translators: 1: name of the place found, 2: position of the point in the list. */ 'said_search_added' => __( '%1$s added as point %2$s.', 'advanced-custom-fields-multiple-coordinates' ), 'geocode_failed' => __( 'Could not find that location.', 'advanced-custom-fields-multiple-coordinates' ), ); } /** * Renders the field interface. * * Shared by the ACF 5/6 and the legacy ACF 4 field type implementations, which * used to carry two copies of the same markup and drift apart. * * @param array $args { * @type string $uid unique id fragment derived from the field name. * @type string $name the input name ACF posts the value under. * @type string $values the JSON encoded value. * @type string $shape 'none', 'line' or 'area'. * @type string $style 'sharp', 'smoothed' or 'bbox'. * @type string $color hex colour of the shape. * @type bool $markers whether the front end should draw the markers. * } */ function acfmc_render_field_markup( $args ) { $uid = isset( $args['uid'] ) ? (string) $args['uid'] : ''; $name = isset( $args['name'] ) ? (string) $args['name'] : ''; $values = isset( $args['values'] ) ? (string) $args['values'] : ''; $shape = isset( $args['shape'] ) && in_array( $args['shape'], acfmc_shapes(), true ) ? $args['shape'] : 'none'; $style = isset( $args['style'] ) && in_array( $args['style'], acfmc_styles(), true ) ? $args['style'] : 'sharp'; $color = isset( $args['color'] ) ? (string) $args['color'] : ACFMC_DEFAULT_COLOR; $markers = isset( $args['markers'] ) ? (bool) $args['markers'] : true; // The style menu, the colour and the marker switch only mean something once // a shape is chosen, so they stay out of the toolbar until one is. ?>
> > >