0

when i do a var dump of ($fields), i get this. i am trying to get the object element => @attributes => article

protected 'autofocus' => boolean false
  protected 'element' => 
    object(SimpleXMLElement)[570]
      public '@attributes' => 
        array (size=9)
          'name' => string 'terms' (length=5)
          'type' => string 'terms' (length=5)
          'label' => string 'PLG_USER_TERMS_FIELD_LABEL' (length=26)
          'description' => string 'PLG_USER_TERMS_FIELD_DESC' (length=25)
          'default' => string '0' (length=1)
          'filter' => string 'integer' (length=7)
          'required' => string 'true' (length=4)
          'article' => string '6' (length=1)
          'note' => string '' (length=0)

tried echo $field->element['article']

How do i get the value of 6 for article?

1 Answer 1

1

Use Joomla\CMS\Form\FormField::getAttribute() method:

$field->getAttribute('article');
1
  • worked like a charm Aug 28, 2021 at 12:54

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.