esc_attr__( 'None', 'bs4' ), 'primary' => esc_attr__( 'Primary', 'bs4' ), 'secondary' => esc_attr__( 'Secondary', 'bs4' ), 'success' => esc_attr__( 'Success', 'bs4' ), 'danger' => esc_attr__( 'Danger', 'bs4' ), 'warning' => esc_attr__( 'Warning', 'bs4' ), 'info' => esc_attr__( 'Info', 'bs4' ), 'light' => esc_attr__( 'Light', 'bs4' ), 'dark' => esc_attr__( 'Dark', 'bs4' ), ); if ( 'btn' !== $type || 'alert' !== $type || 'badge' !== $type ) { $colors[]['white'] = esc_attr__( 'White', 'bs4' ); } if ( 'btn' === $type ) { $colors[]['link'] = esc_attr__( 'Link', 'bs4' ); } return $colors; } /** * Return the default choices for Bootstrap component colors. * * Used as function so it can be easily used across files, like plugin customizers. * * @param array $classes Component CSS classes. * @param string $type Optional. Used to determine what colors are returned. Default bg. * * @return bool */ function bs4_component_has_color_class( $classes, $type = 'bg' ) { $retval = false; if ( $classes && is_array( $classes ) ) { $twbs_colors = array_keys( bs4_component_colors_default( $type ) ); foreach ( $twbs_colors as $color ) { $color_class = $type . '-' . $color; if ( in_array( $color_class, $classes, true ) ) { $retval = true; } } } return $retval; }