1941 | | function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) { |
1942 | | echo get_submit_button( $text, $type, $name, $wrap, $other_attributes ); |
| 1941 | function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null, $source = null ) { |
| 1942 | $args = array([ |
| 1943 | 'text' => $text, |
| 1944 | 'type' => $type, |
| 1945 | 'name' => $name, |
| 1946 | 'wrap' => $wrap, |
| 1947 | 'other_attributes' => $other_attributes, |
| 1948 | 'source' => $source |
| 1949 | ]); |
| 1950 | echo get_submit_button( $args ); |
1950 | | * @param string $text Optional. The text of the button. Default 'Save Changes'. |
1951 | | * @param string $type Optional. The type and CSS class(es) of the button. Core values |
1952 | | * include 'primary', 'small', and 'large'. Default 'primary large'. |
1953 | | * @param string $name Optional. The HTML name of the submit button. Defaults to "submit". |
1954 | | * If no id attribute is given in $other_attributes below, `$name` will |
1955 | | * be used as the button's id. Default 'submit'. |
1956 | | * @param bool $wrap Optional. True if the output button should be wrapped in a paragraph |
1957 | | * tag, false otherwise. Default true. |
1958 | | * @param array|string $other_attributes Optional. Other attributes that should be output with the button, |
1959 | | * mapping attributes to their values, such as `array( 'tabindex' => '1' )`. |
1960 | | * These attributes will be output as `attribute="value"`, such as |
1961 | | * `tabindex="1"`. Other attributes can also be provided as a string such |
1962 | | * as `tabindex="1"`, though the array format is typically cleaner. |
1963 | | * Default empty. |
| 1958 | * @param array of arguments (required) |
| 1959 | * arguments include : text, type, name, wrap, other_attributes, and source |
| 1960 | `source` is new. It helps identify the source or page on which the button |
| 1961 | exists. This is to enable add custom funcionality for different pages. In |
| 1962 | this case, we can make a pop up warning the user who wants to change the |
| 1963 | site url, or guide them on how best they can relocate to new address! |
| 1964 | * |
1966 | | function get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) { |
| 1967 | function get_submit_button( $args = array() ) { |
| 1968 | //set variables |
| 1969 | $text = isset( $args['text'] ) ? $args['text'] : ''; |
| 1970 | $type = isset( $args['type'] ) ? $args['type'] : 'primary large'; |
| 1971 | $name = isset( $args['name'] ) ? $args['name'] : 'submit'; |
| 1972 | $wrap = isset( $args['wrap'] ) ? $args['wrap'] : true; |
| 1973 | $other_attributes = isset( $args['other_attributes'] ) ? $args['other_attributes'] : ''; |
| 1974 | $source = isset( $args['source'] ) ? $args['source'] : ''; |
| 1975 | |