2

here is github gist link : https://gist.github.com/gupta2205/b33dcf762876e5df34d9

//trying to make array out of fetured petitions 
// i guess i am doing something wrong in writing it 
//do i need "foreach" here ? to get individual petition->call_to_action access and set key value in array or how can i do it ? please suggest

   $featureList = array(
    '0' => 'before '.Petition::getFeaturedPetitions()->call_to_action.'petition',
    '1'=>  'before '.Petition::getFeaturedPetitions()->call_to_action.'petition',
            )  

1 Answer 1

2

You probably will have to do something like this:

$featureList = array();

foreach(Petition::getFeaturedPetitions() as $petition)
{
    $featureList[$petition->id] = 'before '.$petition->call_to_action.'petition';
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.