Created
August 4, 2021 22:46
-
-
Save rafiahmedd/e2e694b996ffd6428728b7beff684870 to your computer and use it in GitHub Desktop.
Adding data from RSS feed to FF dropdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('fluenform_rendering_field_data_select', function ($data, $form) { | |
//Repleace the 44 with your form id | |
if ($form->id != 44) { | |
return $data; | |
} | |
// check if the name attriibute is 'dropdown' | |
if (\FluentForm\Framework\Helpers\ArrayHelper::get($data, 'attributes.name') != 'dropdown') { | |
return $data; | |
} | |
$feeds = []; | |
$content = file_get_contents('https://bhworldwideltd.peoplehr.net/Pages/JobBoard/CurrentOpenings.aspx?o=ec8033a9-2dee-47f8-843c-90db10401524'); | |
$temp = new SimpleXmlElement($content); | |
foreach($temp->channel->item as $entry) { | |
$feed = [ | |
"label" => $entry->title, | |
"value" => $entry->title, | |
"calc_value" => "" | |
]; | |
$feeds[] = $feed; | |
} | |
$data['settings']['advanced_options'] = $feeds; | |
return $data; | |
}, 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment