fieldIdentifier = $fieldIdentifierInput; $this->fieldName = $fieldNameInput; $this->sectionPage = $sectionPageInput; $this->sectionName = $sectionNameInput; $this->optionGeneral = get_option('schema_locations') ?: []; //This is a small fix for naming if($this->fieldName == 'Metadata'){ $this->fieldName = 'Site-meta'; } $this->pmdt_create_field(); } /** * The main function used to create a field. * * @since 0.17 */ function pmdt_create_field(){ add_settings_field( 'schema_locations['.$this->fieldIdentifier.']', // ID used to identify the field throughout the theme $this->fieldName, // The label to the left of the option interface element array( $this, 'pmdt_field_draw' ), // The name of the function responsible for rendering the option interface $this->sectionPage, // The page on which this option will be displayed $this->sectionName // The name of the section to which this field belongs ); $this->optionGeneral[$this->fieldIdentifier] = isset($this->optionGeneral[$this->fieldIdentifier]) ? $this->optionGeneral[$this->fieldIdentifier] : ''; //Adding field to accumulated option update_option('schema_locations', $this->optionGeneral); } /** * The main function used to render the description of the field. * * @since 0.17 */ function pmdt_field_draw(){ echo 'optionGeneral[$this->fieldIdentifier]) ? ($this->optionGeneral[$this->fieldIdentifier] == 1 ? 1 : 0) : 0, false) . '/>'; //Outputting messages for the site level -- book level metadata if($this->fieldName == 'Site-meta'){ if(site_cpt::pressbooks_identify()){ _e('
If you enable this you will be able to add metadata to your Book from Book Info menu.
', 'all-in-one-metadata'); }else{ _e('If you enable this you will be able to add metadata to your Site from Site Metadata submenu under Tools
', 'all-in-one-metadata'); } }else if($this->fieldName == __('Allow Overwrite', 'all-in-one-metadata')){ _e('If you enable this you allow the super admin to take full access on your site metadata.
', 'all-in-one-metadata'); } } }