Ejemplo n.º 1
0
 /**
  * Get the widget's data.
  *
  * @return mixed
  */
 public function get_data()
 {
     $data = parent::get_data();
     $data['logo'] = Acf::get_option_field('contact_details_logo');
     $data['address'] = Acf::get_option_field('contact_details_address');
     $data['phone'] = Acf::get_option_field('contact_details_phone');
     $data['email'] = Acf::get_option_field('contact_details_email');
     return $data;
 }
Ejemplo n.º 2
0
 /**
  * Transform to get the WP and ACF fields of the sub post.
  *
  * @param array $field The field.
  * @return array
  */
 public static function transform_sub_post_fields(&$field)
 {
     if (is_array($field['value'])) {
         $data = [];
         foreach ($field['value'] as $post_id) {
             $data[] = Acf::get_post_field($post_id);
         }
         $field['value'] = $data;
     } else {
         $field['value'] = Acf::get_post_field($field['value']);
     }
 }
Ejemplo n.º 3
0
 /**
  * Get the widget's data.
  *
  * @return mixed
  */
 public function get_data()
 {
     $data = parent::get_data();
     $data['items'] = Acf::get_option_field('social_links');
     return $data;
 }
Ejemplo n.º 4
0
 /**
  * Get a fallback image for the post.
  *
  * @param \WP_Post $post The post.
  * @return mixed
  */
 private static function get_fallback_image($post)
 {
     $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
     if (empty($image)) {
         $logo = Acf::get_option_field(SiteIdentity::LOGO_KEY);
         $image = is_array($logo) ? $logo['src'] : get_site_icon_url();
     }
     return $image;
 }
Ejemplo n.º 5
0
 /**
  * Get the data.
  *
  * @Override
  * @param \WP_REST_Request $request The request.
  *
  * @return array|\WP_Error
  */
 public function endpoint_callback(\WP_REST_Request $request)
 {
     $data = array_merge(['site_name' => get_bloginfo('name'), 'site_description' => get_bloginfo('description'), 'site_icon' => get_site_icon_url(), 'menus' => Menus::get_all_locations(), 'widgets' => Widgets::get_all_areas(), 'gravity_forms' => GravityForms::get_settings()], Acf::get_option_field());
     return $this->filter_data($data);
 }
Ejemplo n.º 6
0
 /**
  * Get all ACF fields for the user.
  *
  * @param array 		   $object     The current object.
  * @param string 		   $field_name The field name.
  * @param \WP_REST_Request $request    The request.
  * @return array
  */
 public static function get_user_fields($object, $field_name, $request)
 {
     return Acf::get_user_field($object['id']);
 }
Ejemplo n.º 7
0
 /**
  * Get the widget's data
  *
  * @return mixed
  */
 public function get_data()
 {
     $settings = $this->get_settings()[$this->number];
     return array_merge(['title' => $settings['title']], Acf::get_widget_field($this->id));
 }