Skip to content
Snippets Groups Projects

Draft: fix(disabled): added param to set_disabled

Closed Krzysztof Dyszczyk requested to merge fix/set_disabled into master
1 unresolved thread
2 files
+ 8
2
Compare changes
  • Side-by-side
  • Inline

Files

+ 4
2
@@ -157,10 +157,12 @@ abstract class BasicField implements Field {
@@ -157,10 +157,12 @@ abstract class BasicField implements Field {
}
}
/**
/**
 
* @param bool $bool
 
*
* @return $this
* @return $this
*/
*/
public function set_disabled() {
public function set_disabled( $bool = true ) {
    • idea była taka, że jeśli będzie taka potrzeba to dodamy set_enabled :)

      By Dyszczo on 2020-11-05T10:32:02 (imported from GitLab)

      • Ok, to może wyjaśnie. Musze dodać do deklaracji set_disabled jeżeli jakiś jest tam warunek.

        		( new InputTextField() )
        			->set_name( 'invoice_date_of_sale_label' )
        			->set_disabled()
        			->set_label( __( 'Label for Date of Sale', 'flexible-invoices-core' ) )
        			->set_default_value( __( 'Date of sale', 'flexible-invoices-core' ) )
        			->set_description( __( 'Enter the label for "date of sale" visible on the PDF invoice, i.e. "date of delivery". It will be used on all new and edited invoices.', 'flexible-invoices-core' ) ),

        Wiec mógłbym tutaj zrobić dekoratora, albo zmiany w bibliotece. Dekorator przyjmowałby ten obiekt i dodawał set_disabled jeżeli warunek był”y true.

        By Piotr Po on 2020-11-05T10:35:42 (imported from GitLab)

      • możesz też wrzucić

        ( $stefan = new InputTextField() )
        				->set_name( 'invoice_date_of_sale_label' )
        				->set_label( __( 'Label for Date of Sale', 'flexible-invoices-core' ) )
        				->set_default_value( __( 'Date of sale', 'flexible-invoices-core' ) )
        				->set_description( __( 'Enter the label for "date of sale" visible on the PDF invoice, i.e. "date of delivery". It will be used on all new and edited invoices.', 'flexible-invoices-core' ) ),
        
        ...
        
        if (costam) $stefan->set_disabled()

        By Dyszczo on 2020-11-05T10:43:38 (imported from GitLab)

      • Please register or sign in to reply
Please register or sign in to reply
$this->attributes['disabled'] = true;
$this->attributes['disabled'] = $bool;
return $this;
return $this;
}
}
Loading