get_setting() публичный Метод

This function makes sure that we have means to get essential settings in the same way as for fields etc.
public get_setting ( string $name, string $default_value = '' ) : string
$name string
$default_value string
Результат string
Пример #1
0
 /**
  * Dont add more than one brick to a layout
  * @param \fewbricks\bricks\brick $brick
  * @return $this
  */
 public function add_brick($brick)
 {
     $brick->set_is_layout(true);
     $brick_fields = $brick->get_settings($this)['fields'];
     foreach ($brick_fields as $brick_field) {
         $this->settings['sub_fields'][] = $brick_field;
     }
     // Set name and label of layout to that of the brick
     $this->set_setting('name', $brick->get_setting('name'));
     if ($this->get_setting('label') === '') {
         $this->set_setting('label', $brick->get_setting('label'));
     }
 }
Пример #2
0
 /**
  * @param repeater|flexible_content|\fewbricks\bricks\brick $object_to_prepare_for
  * @param $setting
  */
 private function prepare_label_addition($object_to_prepare_for, $setting)
 {
     if ('' !== ($field_label_addition = $object_to_prepare_for->get_setting('field_label_' . $setting, ''))) {
         if ($setting == 'prefix') {
             $new_label = $field_label_addition . ' - ' . $this->get_setting('label');
         } else {
             $new_label = $this->get_setting('label') . ' - ' . $field_label_addition;
         }
         $this->set_setting('label', $new_label);
     }
 }
Пример #3
0
 /**
  * @param \fewbricks\acf\fields\repeater|\fewbricks\acf\fields\flexible_content|\fewbricks\bricks\brick $object_to_prepare_for
  * @param $setting
  */
 private function prepare_label_addition($object_to_prepare_for, $setting)
 {
     if ('' !== ($field_label_extra = $object_to_prepare_for->get_setting('field_label_' . $setting, ''))) {
         // If the break we are dealing with has a prefix, we need to respect that.
         if ('' !== ($my_field_label_extra = $this->get_setting('field_label_' . $setting, ''))) {
             $field_label_extra .= ' - ' . $my_field_label_extra;
         }
         $this->set_setting('field_label_' . $setting, $field_label_extra);
     }
 }