| @@ 562-592 (lines=31) @@ | ||
| 559 | * |
|
| 560 | * @param string $layout |
|
| 561 | */ |
|
| 562 | public function set_layout( $layout ) { |
|
| 563 | $available_layouts = array( |
|
| 564 | self::LAYOUT_GRID, |
|
| 565 | self::LAYOUT_TABBED_HORIZONTAL, |
|
| 566 | self::LAYOUT_TABBED_VERTICAL, |
|
| 567 | self::LAYOUT_LIST, |
|
| 568 | ); |
|
| 569 | ||
| 570 | if ( $layout === self::LAYOUT_TABBED ) { |
|
| 571 | // The library used to provide just one kind of tabs -- horizontal ones. Later vertical tabs were added. |
|
| 572 | // So the "tabbed" name was renamed to "tabbed-horizontal" and "tabbed-vertical" layout was introduced. |
|
| 573 | _doing_it_wrong( __METHOD__, sprintf( __( 'Complex field "%1$s" layout is deprecated, please use "%2$s" or "%3$s" instead.', 'carbon_fields' ), self::LAYOUT_TABBED, self::LAYOUT_TABBED_HORIZONTAL, self::LAYOUT_TABBED_VERTICAL ), null ); |
|
| 574 | ||
| 575 | $layout = self::LAYOUT_TABBED_HORIZONTAL; |
|
| 576 | } |
|
| 577 | ||
| 578 | if ( ! in_array( $layout, $available_layouts ) ) { |
|
| 579 | $error_message = 'Incorrect layout ``' . $layout . '" specified. ' . |
|
| 580 | 'Available layouts: ' . implode( ', ', $available_layouts ); |
|
| 581 | ||
| 582 | Incorrect_Syntax_Exception::raise( $error_message ); |
|
| 583 | } |
|
| 584 | ||
| 585 | if ( $layout === self::LAYOUT_LIST ) { |
|
| 586 | _doing_it_wrong( __METHOD__, __( 'Complex field <code>' . self::LAYOUT_LIST . '</code> layout is deprecated, please use <code>set_width()</code> instead.', 'carbon_fields' ), null ); |
|
| 587 | } |
|
| 588 | ||
| 589 | $this->layout = $layout; |
|
| 590 | ||
| 591 | return $this; |
|
| 592 | } |
|
| 593 | ||
| 594 | /** |
|
| 595 | * Set the minimum number of entries. |
|
| @@ 571-601 (lines=31) @@ | ||
| 568 | * |
|
| 569 | * @param string $layout |
|
| 570 | */ |
|
| 571 | public function set_layout( $layout ) { |
|
| 572 | $available_layouts = array( |
|
| 573 | self::LAYOUT_GRID, |
|
| 574 | self::LAYOUT_TABBED_HORIZONTAL, |
|
| 575 | self::LAYOUT_TABBED_VERTICAL, |
|
| 576 | self::LAYOUT_LIST, |
|
| 577 | ); |
|
| 578 | ||
| 579 | if ( $layout === self::LAYOUT_TABBED ) { |
|
| 580 | // The library used to provide just one kind of tabs -- horizontal ones. Later vertical tabs were added. |
|
| 581 | // So the "tabbed" name was renamed to "tabbed-horizontal" and "tabbed-vertical" layout was introduced. |
|
| 582 | _doing_it_wrong( __METHOD__, sprintf( __( 'Complex field "%1$s" layout is deprecated, please use "%2$s" or "%3$s" instead.', 'carbon_fields' ), self::LAYOUT_TABBED, self::LAYOUT_TABBED_HORIZONTAL, self::LAYOUT_TABBED_VERTICAL ), null ); |
|
| 583 | ||
| 584 | $layout = self::LAYOUT_TABBED_HORIZONTAL; |
|
| 585 | } |
|
| 586 | ||
| 587 | if ( ! in_array( $layout, $available_layouts ) ) { |
|
| 588 | $error_message = 'Incorrect layout ``' . $layout . '" specified. ' . |
|
| 589 | 'Available layouts: ' . implode( ', ', $available_layouts ); |
|
| 590 | ||
| 591 | Incorrect_Syntax_Exception::raise( $error_message ); |
|
| 592 | } |
|
| 593 | ||
| 594 | if ( $layout === self::LAYOUT_LIST ) { |
|
| 595 | _doing_it_wrong( __METHOD__, __( 'Complex field <code>' . self::LAYOUT_LIST . '</code> layout is deprecated, please use <code>set_width()</code> instead.', 'carbon_fields' ), null ); |
|
| 596 | } |
|
| 597 | ||
| 598 | $this->layout = $layout; |
|
| 599 | ||
| 600 | return $this; |
|
| 601 | } |
|
| 602 | ||
| 603 | /** |
|
| 604 | * Set the minimum number of entries. |
|