fieldIdentifier = $fieldIdentifierInput; $this->fieldName = $fieldNameInput; $this->sectionPage = $sectionPageInput; $this->sectionName = $sectionNameInput; //This is a small fix for naming if($this->fieldName == 'Metadata'){ $this->fieldName = 'Book Info'; } $this->pmdt_create_field(); } /** * The main function used to create a field. * * @since 0.9 */ function pmdt_create_field(){ add_settings_field( $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 ); //Registering field register_setting( $this->sectionPage, $this->fieldIdentifier); } /** * The main function used to render the description of the field. * * @since 0.9 */ function pmdt_field_draw(){ if($this->fieldName == __('Allow', 'all-in-one-metadata')) { $readOnly = get_blog_option(1, 'force_overwr') == 1 ? 'disabled' : ''; echo 'fieldIdentifier ), false) .' '.$readOnly.'/>'; if ($readOnly == 'disabled') { echo ''; } } else { echo 'fieldIdentifier ), 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-Meta submenu
', 'all-in-one-metadata'); } }else if($this->fieldName == __('Allow', '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'); } } }