/** * @param \fewbricks\acf\field-group|\fewbricks\acf\layout|\fewbricks\acf\fields\repeater|\fewbricks\acf\fields\flexible_content|\fewbricks\bricks\brick $object_to_get_for * @return array */ public function get_settings($object_to_get_for) { $this->prepare_settings($object_to_get_for); $this->set_fields(); $this->set_project_fields(); $this->remove_fields(); if (is_a($object_to_get_for, 'fewbricks\\acf\\layout')) { $this->set_is_layout(true); // We need a hidden field to tell us what class we are dealing with when looping layouts in the frontend. $this->add_field((new acf\fields\hidden('Brick class', 'brick_class', '7001010000a'))->set_setting('default_value', \fewbricks\helpers\get_real_class_name($this))); } elseif (is_a($object_to_get_for, 'fewbricks\\acf\\fields\\repeater')) { $this->set_is_sub_field(true); } return ['name' => $this->name, 'key' => $this->key, 'is_layout' => $this->is_layout, 'is_sub_field' => $this->is_sub_field, 'is_option' => $this->is_option, 'fields' => $this->fields, 'field_label_prefix' => $this->field_label_prefix, 'field_label_suffix' => $this->field_label_suffix]; }
/** * Executes a template file for the current class and returns the output. * Implements filter fewbricks/brick/brick_template_base_path allowing you to override where the template file * resides. Value returned by the hook should end with a slash. Note that the filter will only run if * the first argument to this funciton is false. * @param bool|string $template_base_path If you want to set a specific base path, pass it here. End with a slash. * @return string */ protected function get_brick_template_html($template_base_path = false) { if ($template_base_path === false) { $template_base_path = apply_filters('fewbricks/brick/brick_template_base_path', get_stylesheet_directory() . '/fewbricks/bricks/'); } $template_path = $template_base_path . str_replace('_', '-', \fewbricks\helpers\get_real_class_name($this)) . '.template.php'; ob_start(); /** @noinspection PhpIncludeInspection */ include $template_path; return ob_get_clean(); }