Refactor widgets

All widgets use new form/builder class and updater class.
Also fixes function visibility issues, defaults.
This commit is contained in:
Robin Cornett
2017-08-09 08:05:09 -04:00
parent 9919433095
commit db5b6a7659
7 changed files with 568 additions and 350 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
<?php
$value = isset( $instance[ $args['id'] ] ) ? $instance[ $args['id'] ] : $this->parent->defaults[ $args['id'] ];
$defaults = $this->parent->defaults();
$value = isset( $instance[ $args['id'] ] ) ? $instance[ $args['id'] ] : $defaults[ $args['id'] ];
echo '<p>';
printf( '<input type="hidden" name="%s" value="0" />', esc_attr( $this->parent->get_field_name( $args['id'] ) ) );
printf( '<input id="%s" type="checkbox" name="%s" value="1" %s/>', esc_attr( $this->parent->get_field_id( $args['id'] ) ), esc_attr( $this->parent->get_field_name( $args['id'] ) ), checked( 1, esc_attr( $value ), false ) );