texts: Omega theme not rendering correctly when css aggregation is disabled

texts:
I have tried clearing the drupal caches and manually deleting the aggregated files. Also tried clearing the browser cache.

Anyone seen this problem before?


texts: Is there a way to set up sms/email notifications to be sent out to site users responsible for each workflow stage? Also, is there a way of automatically "assigning" a node to the correct resource for managing the workflow stage?


texts: Warning: Invalid argument supplied for foreach() in [...]/domain_conf.module on line 37

texts:
I can't figure out what is causing the problem and how to fix it. The error from domain_conf.module is in this foreach:

$data = array();
$data = db_fetch_array(db_query("SELECT settings FROM {domain_conf} WHERE domain_id = %d", $domain['domain_id']));
if (!empty($data)) {
    global $conf;
    $settings = domain_unserialize($data['settings']);

    // Overwrite the $conf variables.
    foreach ($settings as $key => $value) {
      if ($value === 'domain-conf-ignore') {
        continue;
      }
    ...

I did var_dump($settings) before the foreach and the output was bool(false).

Background:

This is a copy of our live site on a new local webserver we set up for development and testing. So I don't know if this has always existed and is only showing up now that Xdebug is on or if this is new due to the migration.

I installed variable check module and there are no problems with my variable table.

Update:

I did a couple more var_dumps and found that it is domain_id "11" and found that in the domain_conf table. I opened the blob and found a couple of serialized string that I can fix.

Now I just need to find out how to edit the blob and hopefully the issue will be  fixed.


texts: How to list profile fields in a tableselect?

texts:
I'm attempting to list out all the fields a user profile object would have into a tableselect. This will be displayed on the configuration screen of a module that I have been building. I have managed to make a tabelselect with checkboxes and dropdowns in it. That part I got down.

The part that I thought would be easy and ended up getting me stuck is getting an array of the fields a profile has. This would include any user made profile fields. Is there a simple way to get an array of the profile fields without needing to relate it to a user? The module would need this list on the front end for anonymous users so comparing it to the user would not work.

I don't need the values of any fields just the names and type of field maybe some settings like max and min. But will not need the value of any set user.


texts: theme_preprocess_views_view_fields() function in drupal7 does not accept static variable as index

texts:
This is my code

function THEME_preprocess_views_view_fields(&$variables)
{
    static $i = 0;
    $variables['address'] = t($variables['view']->result[$i]->field_address[0]['raw']['uri']);
    $variables['address1'] = t($variables['view']->result[0]->field_address[0]['raw']['uri']);
    $i++;
}

I wrote the following code in views-view-fields-VIEWNAME--page.tpl.php :

<?php print $address; ?>
<?php print $address1; ?>

the second print successfully printed its relevant value but the first one displayed nothing.

I tried to use this trick but i failed :

<?php
if($i==0)
    $variables['address'] = t($variables['view']->result[0]->field_address[0]['raw']['uri'];
if($i==1)
    $variables['address'] = t($variables['view']->result[1]->field_address[0]['raw']['uri'];
.
.
.

?>

why can't I use static variable as index?

UPDATE

after useful comment of Clive and arpitr I modified my code and I created two THEME_preprocess_views_view_fields functions separately as follow:

function THEME_preprocess_views_view_fields(&$variables)
{
    static $i = 0;
    $view = $variables['view'];
    if($view->name == "MY_VIEW_NAME")
    {
    $variables['address'] = t($variables['view']->result[$i]->field_address[0]['raw']['uri']);
    $i++;
     }
}

and this one

function THEME_preprocess_views_view_fields(&$variables)
{
    static $i = 0;
    $view = $variables['view'];
    if($view->name == "MY_VIEW_NAME")
    {
    $variables['address'] = t($variables['view']->result[$i]->field_address[0]['raw']['uri']);
     }
}

for the upper one it was the result

Array

and the second one (without $i++) successfully printed the right value.


texts: String Overrides is not overriding the "Read more" string

texts:
I've filed a support request on drupal.org about this question, but I figured I should ask here as well because someone could know the answer.

I want to change the "Read more" link in teasers so that it says "Full story". I was pointed to the String Overrides module which supposedly makes it very simple to change the built-in strings. The UI isn't very complicated, so I'm not sure what I could possibly be doing wrong, but it's not working. I have saved the settings, flushed all caches, etc.

Do you have any idea?


texts:
I am working on a directory for a membership organization.

I am trying to create two distinct user pages. One for the user themselves (and admins) and one for the public to view. I would like these formatted differently, not just show different fields (which I could do simply with permissions, right?). And these public pages need to include Profile2 profile data.

I have tried editing the user-profile.tpl.php page. For example:

<div class="profile"<?php print $attributes; ?>>

  <?php print render($user_profile['field_first_name']); ?>
  <?php print render($user_profile['field_last_name']); ?>

</div>

...but this seems to have no effect on the user page at all, even when I clear all caches. (Perhaps because I'm using Display Suite to layout the user profile page? Does that override everything else?)

I also created a View:

Contextual Filter

User:Uid
Provide default value: Type = User ID from URL
Specify validation criteria: Validator=User

Relationship

User:Profile
Profile types (all 3 custom profile types chosen)

Path: /users/%user

But I'm still just getting the Display Suite layout. Is that doing the override?


texts: How do I show or hide a Views block based on a boolean field in the displayed node?

texts:
I have searched and searched for an answer to this, so hopefully I'm not asking something that is answered elsewhere.

I have a content type with a boolean field that show or hide a form. On each of that content type node pages, I want to show a block if the boolean field is set to true.

So, in essence, the boolean on the content type tells whether or not to show the block.

Right now I have the form (via the Webform Module) displaying as a block using Views. I think I can set a contextual filter to determine if the block is shown or not, but I am having a ton of trouble getting it to do that.

So, how do I set up contextual filters to show the block if a boolean field is set in the content type to true and not if it's false?


texts: How to calculate number of submitted webforms?

texts:
I want to show the number of submitted webforms in a block in the front page of my website.

I searched and found (( function webform_get_submission_count )) . But I'm absolute beginner: I know it is inside webform.submission.inc, but then where shall I call it? How to place it in a block like in the following image:

Any help would be greatly appreciated.


texts: Drupal: node_load() in php file - load via ajax

texts:
i try to load a node in Drupal 7 in a php file, which will be loaded with ajax.

my php file looks like this:

require_once '../../../includes/bootstrap.inc';
$i = 16;
$content = node_load($i);

The include of bootstrap.inc works fine, but this file returns 'PHP Fatal error: Call to undefined function node_load()'. i guess i've read that the function node_load needs the bootstrap.inc file, but it doesnt seems so.

Is there any possible way to use the node_load function right without 'register' a module in drupal - i just want to load a self made php file, which just returns the content of a node - without the template!


texts: taxonomy_node_get_terms(arg(1)) kills layout in page.tpl.php

texts:
I use this function to get the node's taxonomy term.

$tax = taxonomy_node_get_terms(arg(1));

Calling this function destroys the layout of the page. Why?


texts: How can I filter specific user on Views list?

texts:
Using Views 3.

I have User view and here, list all user by post count. It's working. But I want, ignore admin user post count in this view. How can I filter my views to not show admin in the view list?


texts:
I want to add a call for 2 external scripts in the page.tpl.php.

The scripts are:

 <script type="text/javascript" src="http://use.typekit.com/12345.js"></script>
 <script type="text/javascript">try{Typekit.load();}catch(e){}</script>

Now in D7 you can call them directly from page.tpl.php like

drupal_add_js()

right?

But I'm working on a D6 site right now.

So within mytheme directory I add to my template.php file

function mytheme_preprocess_page(&$vars, $hook) {
    drupal_set_html_head('<script type="text/javascript" src="http://use.typekit.com/12345.js"></script>');
    $vars['head'] = drupal_get_html_head();
  }

It doesn't work. The page no longer loads.

So the question is, How do I get both those scripts in the head? What should the code look like? I know the real answer is learn php, but in the meantime


texts: How to add a password reset link in the "Administration Views"

texts:
The administration views on drupal 7 https://www.drupal.org/project/admin_views
replaces user page with a new views. I would like add a password reset link which would send a password reset email to specific user. How can I do this easily please? Thanks


texts: Type eror in call to Form Submit handler

texts:
I am writing a module that adds fields to Simplenews forms, including a custom submit handler. This is working fine on my test site, but when i migrate to my production site, I get the following error:

Recoverable fatal error: Argument 2 passed to simple_conreg_simplenews_form_submit() must be an instance of FormStateInterface, instance of Drupal\\Core\\Form\\FormState given in /var/www/drupal/sites8/all/modules/simple_conreg/simple_conreg.module on line 193

My handler is defined as:

function simple_conreg_simplenews_form_submit ($form, FormStateInterface $form_state)

I can get it to work on my production site by changing to:

function simple_conreg_simplenews_form_submit ($form, $form_state)

However, it would be nice to have type checking enforced.

Any idea why this is happening when the same definition works on the test site?


texts:
I follow drupal core module dashborad to create a module.

When I visit my custom dashboard page, all block content show:empty.

But I know they shouldn't be.

After check my module code with dashbord.module, I use dpm() to dump the $page in
dashboard_page_build function.

And I found the different bettwen my module and dashbord.module.

In dashbord.module the $page like:

In my module the $page like :

The different is :
my module hook_page_build function $page don't have my dashbord region.

But I check dashboard.module manay times without find where to add dashboard regions to the $page.

Does anyone have good idea ?


texts: OG Menu not appearing in the Parent Menu options after I selected an OG


texts:
I have been reconfiguring my drupal site for faster loading so i restarted from strach, the problem is i can not get rid of the Menu tab which is above the Home tab, if you look at http://beta2.computersuppportservicescs.co.uk you will see what i mean, i have went into the theme setting and untick main menu and seocndary menu and flushed the cache but it is still there.

On http://beta.computersupportservicescs.co.uk you can see i did get rid of it but i think i edit one of the php files directly and commented out the section but i cant remember which one.


texts: A View which displays Posts assigned to a Parent which is followed by current user

texts:
A little advice please:

Users "follow" a content type Parent by using the method in this question. There is a content type Posts which has an Entity Reference to the Parent it is assigned to.

How do I go about creating a View which shows all Posts which the current user has "followed"?

I guess this could be done with Views Field View but that seems a little over-kill. There must be a simpler way of doing this, just with Views out-the-box, surely?

Update

See my answer. Please, please, if anybody has a better solution let me know!


texts:
I have got site seal from positive ssl but cant figure out where to insert it.
Their support option says inset the code in the html body tag. Its very vague for drupal, at least for me to understand because i dont have much knowledge of the drupal internal structure. Can anyone help please?


texts: How to add query parameters to a CacheableJsonResponse's cache?

texts:
I have an API which returns various json, like terms of a vocab, nodes of a type, with specific fields and so on.

Now, in my API I am getting the requested language like so:

$request = \Drupal::request();
$lang = $request->query->get('lang', 'en');

And load the respective translations of the entities.

Now, how can I add that $lang parameter as a cache indicator? So that:

/myapi/nodes?lang=en

creates another cache than:

/myapi/nodes?lang=klingon

Also, is that the right way to deliver language specific content in an API?


texts: Create directory in file system per organic group

texts: I am using Drupal 7 and I am creating a content type which is a content of an Organic Group. This content type has a file field and all the Organic Group Members can create a node of that. I want to grouping the files in the file system with directories automatically named by Organic Groups names and some sub directories named by current date and current user uid. User can be member of 2 or more groups, so the file should be copied to all the groups directories that user selects in the create node form. Any suggestion?


texts: How to create variations in commerce file?

texts: I am creating a ecommerce site selling downloads. Currently, I am trying to get product attributes to work with commerce file. I have created a select list taxonomy for operating systems, so the user uploading the file would be able to select operation systems. I need a way for users to be able to upload different files depending on operating systems they selected, for the same product. Thanks in advance! (I am using a normal Drupal with commerce installed I.e. Not kickstart 2, just a standard Drupal installation)


texts: Adding html tags to the Views module title area

texts:
One of the common things I do with Drupal 7 Views module is that I use the small tag (<small>) to provide a brief description for the view block/page.
For example; Quick Search<small>Search for companies with a keyword</small>
With the Drupal 8 views, it removes the small tag from the title <small>. Is there anyway to stop from Views remove the small tag?


texts: Drupal 7 on new Linode stack, POST/GETS 404ing but pages still loading?

texts:
I'm trying to migrate a site to a new linode environment, and my website has made the journey with the exception(s) that:

I cannot login at /user/login, console shows 404s when submitting credentials and the page simply refreshes. Note: ?q=user DOES work.

When logged in (through ?q=user method), every page i request shows a 404, but then still loads the page. For example, when going to mysite.com/t-shirts, console shows 404 on that address, even though the page loads fine.

Trying to login via colorbox returns (in the modal): Request unsuccessful: error.

All the elements in my pages that use ajax fail, showing 404s in console.

Short URLs SEEM to work, i.e. /catalog returns the proper page (despite 404 in console). I can also get to admin pages with /admin paths, but cannot seem to change anything on those pages because submitting the changes always fails.

What am I missing in migrating this drupal install? Drupal install status whines about GD and cURL missing, but I don't believe this has anything to do with it..

base URL is set to the proper address in settings.php (http://dev.skinnyboyswagclub.com)


texts: Load CKeditor with Simplified Toolbar on dynamically created page element

texts:
Drupal 6
ckeditor 3.6.4

I have page that loads the text area dynamically, so I am using

  CKEDITOR.replace('textarea-id');

Which works, but it is bringing in the full toolbar. I would prefer that the simplified toolbar is used, but it would also be acceptable to use the toolbar I have defined if loading the simplified is not possible. Least desirable would be to hard-code the toolbar, but I consider that a last resort. How do I accomplish this?

I have tried

 CKEDITOR.replace('textarea-id',
    {
        toolbar : 'myprofile'
    });

Which throws  js error:
Type x is undefined
, I think related to the fact that it cant load the profile. Suggestions?


texts:
So I am interested in logging signed, scanned copies of my Ubercart packing slips.  Cool right?  The problem is that Ubercart shipments are not fieldable entities.  Thus I cannot add a file field or even a checkbox to say that I received a signed packing slip.

My plan was to make an entity called 'Signed Packing Slip' with the file field and use entity reference to link it to at least uc_order (because, again I can't link up with Ubercart Shipments because they are not entities).

Can anyone think of a hack or workaround to make this work?  Is there any way to incorporate custom PHP code or database calls through ECK/EntityReference


texts: Using Rules to block system email or prevent from sending?

texts: I have a unique use case. I am currently using mailcontrol module to disabled the sending of emails when news users are created. However I got to thinking about this, and I was wondering if there is a way to create a Rule to prevent the email from sending so I wouldn't have to use the mailcontrol module.


texts: Adding ThirdPartySetting to webform entity results in wrong module dependency

texts:
I added my ThirdPartySetting to webform element like this:
Added my config schema to file config/schema/mymodule.schema.yml like this:
webform.settings.third_party.mymodule:
  type: mapping
  label: 'Webform mymodule configuration'
  mapping:
    settings:
      type: mapping
      label: 'mymodule settings'
      mapping:
        email_element:
          type: string
          label: 'E-mail element'

and then in mymodule.module I've altered webform settings form like this:
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id === 'webform_settings_form') {
    $entity = $form_state->getFormObject()->getEntity();
    $elements = $entity->getElementsInitializedAndFlattened();
    $options = [];
    foreach ($elements as $element_name => $element) {
      $options[$element_name] = $element['#title'];
    }
    $form['third_party_settings']['email_element'] = [
      '#type' => 'details',
      '#title' => t('E-mail element'),
      '#open' => TRUE,
    ];
    $form['third_party_settings']['email_element']['email_element'] = [
      '#type' => 'select',
      '#options' => $options,
      '#title' => t('E-mail element'),
      '#default_value' => $entity->getThirdPartySetting('mymodule', 'email_element'),
    ];
    $form['actions']['submit']['#submit'][] = '_mymodule_form_submit';
  }
}

function _mymodule_form_submit(&$form, FormStateInterface $form_state) {
  /** @var \Drupal\webform\WebformInterface $entity */
  if ($entity = $form_state->getFormObject()->getEntity()) {
    $entity->setThirdPartySetting('mymodule', 'email_element', $form_state->getValue(['third_party_settings','email_element','email_element']));
    $entity->save();
  }
}

This works fine, but when I export my configuration, I see that dummy module has been added to my module dependencies.
 dependencies:
   module:
+    - mymodule
+    - email_element

This also reflects in third_party_settings
+third_party_settings:
+  email_element:
+    email_element: e_mail
+  mymodule:
+    email_element: e_mail

What am I doing wrong?


texts: Can you override a library per environment?

texts:
In my libraries.yml file, I have something like this, being used to define "foo-bar" as a library that can be pulled in from various parts of the site:

foo-bar:
  version: 0.0.x
  js:
    js/foo-dev.js: {}

This works well on my local environment, but on our production and QA environments, I would like for it to look more like this:

foo-bar:
  version: 0.0.x
  js:
    js/foo-prod.js: {}

(The prod version will include optimizations that normally don't appear with minification alone).

Currently, we are using the sites/<site>/settings.*.php files and the config-split module to have different configurations based on the environment, but is there a way to have the foo-bar library reference the dev-friendly version on one environment, and the production version on all others?


texts: Filter views table by terms present in another display

texts:
I have a view with two displays. The first shows nodes that have field "term_field" among others. This first display has an exposed filter of other field.

In my second display, I have a table of nodes of a different content type that also has the same "term_field" (the taxonomy is shared). This second display is attached to the first one.

What I need is that, when I filter the first display, the second one is also filtered by only the terms that are present in the first one.

I hope the requirement is clear. Any one knows how to accomplish this?

Thanks


texts: How to use Rules to send an email to an email id based on a selected in a registration form?

texts:
I have created a rule for sending an email after a new user registered. I would like to add a Rules Condition to send the email to the target based on the selection in the registration form.

For example: if I select the country as india I need to send to india@gmail.com and for other others@gmail.com.

I have tried adding a condition in To mail receipt address:

$email = ($account->country == 'india'? india@gmail.com : 'other@gmail.com')
echo $email;

Can you suggest how to handle the scenario?


texts: Fill in user reference from current user page while adding new content

texts:
I have a view with appointments displayed at the user profile page (using pages for this) that is specific to that user.

While adding a node (appointment type) I can select the user(user reference) that the appointment is made with.

Now, I would like to add a link at the bottom of that view so I can add a new appointment and at the same time pass in the user id/name of the current viewed user, so I don't have to manually select the user again.

Any suggestions?


texts: I am using a custom module that inputs the user profile image into apache solr index and then I use it on a view but the image doesn't show

texts:
I have created the following module and I have managed to input sm_field_main_image into a view. However, the user profile image does not appear. Does anyone know where the mistake is?

<?php
/**
* Build the documents before sending them to Solr.
*
* Supports all types of
* hook_apachesolr_index_document_build_' . $entity_type($documents[$id], $entity, $env_id);
*
* The function is the follow-up for apachesolr_update_index but then for
* specific entity types
*
* @param $document
* @param $entity
* @param $entity_type
*/
function apache_solr_image_apachesolr_index_document_build(ApacheSolrDocument $document, $entity, $entity_type) {
  // Index field_main_image as a separate field
  if ($entity_type == 'user') {
    $user = user_load(1);
    $users = user_load_multiple(array('uid' => $entity->uid));
    $user = reset($users);
    // Hard coded field, not recommended for inexperienced users.
    $document->addField('sm_field_main_image', $user->picture);
  }
}
?>


texts: field widget is not saving selected value to database

texts:
I am creating a widget under taxonomy_term_reference field and trying to use the same autocomplete used by taxonomy module, autocomplete is working fine but data is not getting saved.

    /**
     * Implements hook_field_widget_info().
     */
    function test_field_widget_info() {
      return array(
        'test_widget' => array(
          'label' => t('test Engine'),
          'field types' => array('taxonomy_term_reference'),
          'settings' => array(
            'size' => 60,
            'autocomplete_path' => 'taxonomy/autocomplete',
          ),
          'behaviors' => array(
            'multiple values' => FIELD_BEHAVIOR_CUSTOM,
          ),
        ),
      );
    }

    /**
     * Implements hook_field_widget_form().
     */
    function test_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
      if ($instance['widget']['type'] == 'test_widget') {
        $form_field = array();
        $tags = array();
        foreach ($items as $item) {
          $tags[$item['tid']] = isset($item['taxonomy_term']) ? $item['taxonomy_term'] : taxonomy_term_load($item['tid']);
        }
        $form_field['autocomplete'] = array(
          '#type' => 'textfield',
          '#title' => 'Tags',
          '#default_value' => taxonomy_implode_tags($tags),
          '#autocomplete_path' => 'taxonomy/autocomplete' . '/' . $field['field_name'], // Trying to use the same autocomplete path from taxonomy module.
          '#size' => $instance['widget']['settings']['size'],
          '#maxlength' => 1024,
          '#element_validate' => array('test_validate'),
          '#attributes' => array(
            'class' => array($element['#field_name']),
          ),
        );

        $form_field['search'] = array(
          '#type' => 'button',
          '#value' => t('Search Tags'),
          '#ajax' => array(
            'callback' => '_test_callback',
          ),
          '#attributes' => array(
            'reference_class' => $element['#field_name'],
          ),
          '#name' => $element['#field_name'],
        );
        $element += $form_field;
        return array('tid' => $element);
      }
    }
function test_validate($element, &$form_state, $form) {
  $value = array();
  if ($tags = $element['#value']) {
    // Collect candidate vocabularies.
    $field = field_widget_field($element, $form_state);

    $vocabularies = array();
    foreach ($field['settings']['allowed_values'] as $tree) {
      if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) {
        $vocabularies[$vocabulary->vid] = $vocabulary;
      }
    }
  }
  $typed_terms = drupal_explode_tags($tags);
  foreach ($typed_terms as $typed_term) {
    // See if the term exists in the chosen vocabulary and return the tid;
    // otherwise, create a new 'autocreate' term for insert/update.
    if ($possibilities = taxonomy_term_load_multiple(array(), array('name' => trim($typed_term), 'vid' => array_keys($vocabularies)))) {
      $term = array_pop($possibilities);
    }
    else {
      $vocabulary = reset($vocabularies);
      $term = array(
        'tid' => 'autocreate',
        'vid' => $vocabulary->vid,
        'name' => $typed_term,
        'vocabulary_machine_name' => $vocabulary->machine_name,
      );
    }
    $value[] = (array)$term;
  }
  form_set_value($element, $value, $form_state);
}


texts:
Added a wrapper inside a block.tpl.php called block-content:

<section id="<?php print $block_html_id; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>

  <?php print render($title_prefix); ?>
  <?php if ($title): ?>
    <h2<?php print $title_attributes; ?>><?php print $title; ?>

  <?php endif;?>
  <?php print render($title_suffix); ?>

  <?php print $content ?>

As you can see there is no sign of contextual links in it.

But if you look at the source, contextual links block is put inside the new block-content.

How to move contextual links block outside block-content one level up inside section so they both become children elements?

Goal is to separate block content wrapped in a separate container without contextual links because it interrupts a lot when it comes to CSS.

I got a solution with jQuery, but it's impractical on every page load for every block.


texts: how to make previously entered values appear for multistep forms after validation errors

texts:
so evidently if I turn a form into a multistep form:

  if(!isset($form_state['storage']['step']))
    $form_state['storage']['step'] = 1;

and do form_set_error() in validate

when the validation error appears, the values that I previously put in would disappear.....

so If I enter a value into a textbox in a multistep form then hit continue then validation error appears, the textbox will now be empty instead of being filled with my previously entered values as it would happen normally

is there a way to prevent this from happening without manually reentering the default values for every form element?

fyi I'm using drupal 6


texts: I know Drupal 8 has the quick edit module for inline editing, but how do you turn this feature on for a View that has fields where you can just click to edit it inline?


texts: How to add a filter in view with list of values

texts:
I have a content type which has a Number(Integer) field.

I created a view. I would like to expose the price field as a filter to the public like the following with a list of price range.

In view > filter criteria, I added the price field. How to add the list of values with price range?


texts: Disable (or workaround) form rebuild with managed_file field

texts:
I'm using the Form API to create a custom form. It has a managed_file field and some other fields, some of which are required. If any of the required fields are not filled in, the file upload for the managed_file field doesn't work, and produces an error informing the user to fill out the required field first before the image upload can process.

I'm assuming this is because the form is being rebuilt when the form uploads, but is there a way to stop it from checking for required fields? Surely there is a way, as node edit forms have this functionality working.

Here is my form code (simplified):

function create_event_form($form, &$form_state) {

  $form['event_image'] = array(
    '#type' => 'managed_file',
    '#upload_validators' => array(
      'file_validate_extensions' => array('jpg jpeg gif png')
    ),
    '#upload_location' => 'public://event_images/',
    '#required' => FALSE,
  );

  $form['event_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Event Name'),
    '#required' => TRUE,
  );

  $form['submit_button'] = array(
    '#type' => 'submit',
    '#value' => t('Create Event'),
  );

  return $form;
}

If event_name field is empty when attempting to upload a file, the upload will not process.


texts:
I have a form that has text_format form element with CKEditor in it and it has the image button in toolbar.

This form is being displayed via modal. When I click on the image the image upload/configuration is also in modal but not in a new one, instead it replaces the whole form. And also as I understand jQuery modal there can be only one at a time anyway.

How can I tell the image button to use new modal instead?

Looking at the code, the js dialog settings in drupalimage plugin.js are local, so inaccessible for overwrite, and the \Drupal\editor\Form\EditorImageDialog::submitForm returns CloseModalDialogCommand, which would close the original modal even with JS altered.

So from what I'm looking at the image cannot be used in forms that are displayed in modal at all.


texts: I am newbie in Drupal. Using some articles, I have created a child theme of Bartik in Drupal 8 but I do not know how to override default template files. Can anyone help me to understand the child theme structure in Drupal 8?


texts: Programmatically get current multi-site instance name

texts:
Let's say I have the following multi-site setup:

$sites['hello-world-a.com']       = 'a';
$sites['stage.hello-world-a.com'] = 'a';
$sites['dev.hello-world-a.com']   = 'a';
$sites['hello-world-a.localhost'] = 'a';

$sites['hello-world-b.com']       = 'b';
$sites['stage.hello-world-b.com'] = 'b';
$sites['dev.hello-world-b.com']   = 'b';
$sites['hello-world-b.localhost'] = 'b';

Works fine. Both share the same theme and more or less the same features. Now let's say I have a very simple preprocess function that adds a CSS class to the body:

/**
 * Implements template_preprocess_html().
 */
function MYTHEME_preprocess_html(&$variables) {

  $variables['attributes']['class'][] = 'foo';

}

How can I now add the multi-site instance's name as body class dynamically?

Without going through all possible domain names and string comparison?
Also possibly without working with the human readable site name, which may change?
Maybe with cache contexts?
Or UUID?

/**
 * Implements template_preprocess_html().
 */
function MYTHEME_preprocess_html(&$variables) {

  $variables['attributes']['class'][] = 'foo';

  // Basically along the following pattern.
  if ( @@@ SITE A @@@ ) {
    $variables['attributes']['class'][] = @@@ SITE A @@@;
  }

}


texts: want to display values of content type Article in a page

texts:
I have following fields in my content type Article:

Year: [have values - 2011,2012,2013,2014,2014,2016]
Volume: [have values - 01,02,03,04,05]
Issue: [have values - 1,2,3,4,5]

Title: [some value]
Description: [some text]

Now I want to display fields values like order below in views-view--archives--page.tpl.php

2013: [Volume3: Issue1, Issue 2, Issue 3] 2012: [Volume2: Issue1, Issue 2]


texts: Drupal 7: check login password with DB password

texts:
I'm working on drupal 7, i'm looking for developing customize user log-in module into my site. but facing a problem in that, when we are submit log-in page then password doesn't match with DB password. because drupal not using MD5 encryption method for storing password into it.

So what would be the batter solution for it? how can i achieve my task without fail.?
Please help me, its appreciate.

Thanks.


texts:
So I have a block (just a image hyperlink) that is giving me a headache, due to it not showing up where I want it to do. Inside the block it self I've set the visibility settings to "Only show on sites in the list" and added the specific site in that list.
I've tried different permutations of the site url and tried adding a / and a /* to no avail.

If I set the visibility setting to "Show on all sites" then it shows up on all sites at exactly the place I want it to be, except only on one page.

If anyone can help me with this I'd really appreciate it, never used Drupal before and I can't seem to find any information to help me debug this.

I'm using Drupal 6.26 if that makes a difference.


texts: Facebook like photo gallery with comments, tag photo, share etc

texts:
Is there any Facebook like photo gallery module with comments, tag photo, share option.
Please help in this.


texts: Option for User to edit their own Profile

texts:
Is it possible for the user to be able to edit their own profile without going through the Drupal administration panel?  I have a /user page with views that output the needed fields.  Ideally I would like an 'edit profile' button that loads up the same editable fields.

Could someone point me to how this can be achieved?

Thanks in advance,

P.S.: I'm on Drupal 7. Might be worth noting that I'm using Profile 2 as well.


texts: Convert Acquia Clear Varnish For One URL Curl Command to Drupal::httpClient()

texts:
I am trying to convert a command to php curl or Drupal::httpClient().
The original command
Curl -k -X PURGE -H "X-Acquia-Purge:[site-name]" --compressed -H "Host: example.com" https://bal-12345.prod.hosting.acquia.com/my-url

Here is the conversion I tried (but it is not working) This one returns 200 status code but it is not working.
$varnishUrl = "https://bal-12345.prod.hosting.acquia.com/my-url"
$headers = [
  'X-Acquia-Purge'  => "site-name",
  'Host'            => "example.com"
];
$options = ['headers' => $headers, 'body' => $varnishUrl];
try {
  $client = \Drupal::httpClient();
  $response = $client->request('PURGE', $domainUrl, $options);
  $code = $response->getStatusCode();
  if ($code == 200) {
    return $code;
  }
}
catch (RequestException $e) {
  watchdog_exception('module_name', $e);
}

This is the second conversion to php and also not working.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $varnishUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PURGE');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
$headers = array();
$headers[] = 'X-Acquia-Purge: site-name';
$headers[] = 'Host: example.com';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_exec($ch);
curl_close($ch);

I would appreciate any input.


texts: If I delete enabled module files will items be stuck in the database forever?

texts:
The list that populates the modules page is loaded from the files. But whether a module is enabled or is stored in the database (I assume).

If I enable a module and then delete the files will there be an database entry (to say it's enabled) in the database forever? Or will it be cleared at some time?

Will it slow down the site or clog up my database if I've cleared a lot of modules without disabling them first?


texts: Why am I urged to include my source files via files[] instead of using include_once?

texts: What is the reason of using the .info file to declare the files used from the module, instead of including them at runtime?


texts: Where to add Drupal.t function in a javascript

texts:
Hi I have a string in a string that needs to be translated. What needs to be added to this line to get it done?

  $(language).find('.content').append("
Next step
");  // add next steps to demo voice list


texts: Programmatically accessing a field group relationship

texts:
I believe I am using the default Fieldgroup module. I have added a new group using "Add new group", then I have created a couple test fields and nested them under that group.

I see the entry is added in my 'field_group' table in my database.  What I am wondering is how I can programmatically see that relationship.  Please bear with me. After adding content I am using field_info_instance to view each field for that node.  I do not see any field that shows a connection to the group I created.  Is there a function that would let me see this relationship on a field by field basis??

Thank you,


texts: I am adding images to a mega menu and they are lining up nice, but when an anonymous user is viewing the site, the "edit" and "delete" links are visible over the image. Is there a way to hide them?


texts: Display how many followers and following

texts:
I am using user_relationship module.

I would like to display on user profiles how many followers do they have and how many do they follow...

Can someone help me?

Thank you!


texts: Fatal error: Call to undefined function ctools_include()  While implementing Drupal 6 Multistep Form Using Chaos Tools

texts:
I would like to implement a multi-step user registration form. After a long time googling, I found Intro to Drupal 6 Multistep Form Domination Using Chaos Tools. While I was trying to implement the suggested code, I got the following error:

  Fatal error: Call to undefined function ctools_include() in var/www/WC/drupal_website/sites/all/modules/wombat/wombat/wombat.module on line 26

How do I solve it?


texts: Hook or rules event to identify payment failure in Drupal commerce

texts:
Is there any hook or rules event that will help to catch the payment failure in Drupal Commerce?

Thank you


texts: Ajax Form Not Working in some Some Regions

texts:
I created an ajax based contact form in my module.Then I made a block view for the form. I tried putting that block to several regions. When I put the block to 'Sidebar Second' the form works as desired.But when I put the same block to 'contact' Region (custom region) , the form's ajax part does not work .

This is the code I used to print the block .

$contact = render(block_get_blocks_by_region('contact'));
print  $contact;

When I inspect the element the form-id is 'myform' as given by me . Still the ajax part is not working .


texts:
I have a form:

//...
$form['submit'] = array(
  '#type' => 'submit',
  '#value' => t('Sumbit'),
);

I need when this form is validated and submitted then show a ctools modal.

This is my hook_menu for the modal:

$items['thankyou/%ctools_js'] = array(
    'title' => 'Thank you',
    'page arguments' => array(1),
    'access callback' => TRUE,
    'page callback' => 'thankyou_callback',
    'type' => MENU_CALLBACK,
  );
ctools_include('ajax');
ctools_include('modal');

ctools_modal_add_js();

The callback function:

function thankyou_callback($js = NULL) {
  // Content that we place in the popup.
  $popup_content = t('Thank you!');

  if (!$js) {
    return $popup_content;
  }

  ctools_include('modal');
  ctools_include('ajax');

  $output = array();
  $output[] = ctools_modal_command_display(t('Greetings'), $popup_content);

  print ajax_render($output);
  drupal_exit();
}

My form submit:

function myform_submit($form, &$form_state) {
  // ...
  // show my modal here
  modal.show();  // ???
}

Then, How I show a ctools modal after form submit?

Please, with not ajax callback.


texts: How do I pass a profile field as contextual filter?

texts:
I am trying to pass a profile field as contextual filter in a view. How do I add it?

I need to pass the term ID.


texts: Student TV channel - taxonomising YouTube videos

texts:
This question has been created to break up a previous question; see there for more detail.

As you can guess from the title, I'm the new webmaster for a student TV channel and I need to update the site.

The site needs to pull in YouTube videos from a channel, embed the video player and display a brief description of the video, along with information about the cast & crew involved in the production. Similar videos (such as those in a series) need to be linked together in a "playlist" style, while other videos should be browsable through a gallery based on genre.

Does anyone know what the most effective way to taxonomise these videos would be? I'm thinking of fields genre and series at the moment, but I don't know how I could list cast & crew members. (Videos need to be organised so you can quickly find all of the videos with a cast/crew member involved with)


texts:
Is there any way to programmatically change the Base URL, Just as the "locale" module does..
My Website is multi-lingual which has to recognize 3rd argument, after the language identifier. Some custom code will be triggered when base on the third argument.

Have tried to Find a solution for this but the most of the Solutions suggest settings.php approach.

I am looking for a hook that will allow me to alter the third parameter in the URL for custom functionality.

Sample URL: www.example.com/hi/arg3
Above "hi" is the language identifier and "arg3" will be used for custom functionality. Hence a node to be rendered will have url as  www.example.com/hi/arg3/node/1


texts: How do I programmatically update the allowed values of a list field?

texts:
I have created a field_time_zone field for the Article content type.
I want to set the allowed values for that field to the values returned from system_time_zones().
For this, I implemented hook_form_alter() using the following code.
$zones = system_time_zones();
$entityManager = \Drupal::service('entity_field.manager');
$fields = $entityManager->getFieldStorageDefinitions('node', 'local_market');
$options = options_allowed_values($fields['field_time_zone']);

if(empty($options)) {
$options =  $zones;
$form['field_time_zone']['widget']['#options'] = $options;
}

The code adds the desired values, but the node cannot be saved, as it throws the following error.

The value you selected is not a valid choice.

How can I set the allowed values for a text (list) field?


texts:
How can I join two tables together in drupal 7.

I have a simple database schema and I want to join it to the user table could someone give me a coded example of joining a custom build table to the user table.

If I take a basic table example

$schema['location'] = array (

'descritiption' => 'location',

'fields' => array (
    'locationID' =>  array(
        'description' => 'primary key for patients table',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE),
 ),

'addressone' => array (
 'description'    => 'this shows the first line of the address',
    'type'         => 'TEXT'
),
'county' => array (
    'description' => 'this is a county list'

),
'postcode' => array (
  'deescription' => 'stores the postcode'
),

    'primary_key' => array('locationID')

    );

How would I join this to the user table.
I would like to query data from both tables. So when I add a record into the user table I want the custom table to have the data added as well so there is a link between the two tables.

here is a high level example

user table data

uid 1

username alex

visitor

vis id 1

firstname Alexander

lastname  Brown

So what i want to happen is when i add data into the user table I build a relationship to what is entered in the visitors table. I know you can use a join which has kindly been explained to me but I am not sure what is meant by building the relationships in code.


texts: Cannot Change theme in Drupal 7.24, ACCESS DENIED

texts:
I just did a clean install of Drupal 7.24
Everything seems ok so far, but as soon as I try to change the theme it says ACCESS DENIED. You ARE NOT AUTHORISED TO ACCESS THIS PAGE!!!!
Very strange!!! I was working with same OS and same configuration before, not sure whats happening now....
Can anyone help please?
I have googled and tried every possible solution, but seems not working any of them,I emptied the cache of browser, repaired the session table and cleared cache from drupal settings, but no avail....


texts: Commerce Kickstart 2 - Disable ajax in seach products backend

texts:
How can I disable ajax in admin/commerce/products (Commerce Kickstart 2 menu)? I've searched  in Search API settings but found nothing.

Edit: I found that the View Commerce Backoffice: Products (Content) control the search of products in admin/commerce/products. In section Advanced > OTHER there is field Use AJAX. You can set to Yes or No this field. But even if you set to No, when you search for a product the query is made before you press Enter, what is exactly my client want.

So the question persists, is there a way to change this behavior, to be able to search only when you press Enter?


texts:
I want to add much HTML to my form elements in order to arrange them on the page, I will be using bootstrap framework to do this.

Which method would be better, to create a twig template file or to use HOOK_form_alter?

If the way to do this would be to create a twig template file, then how can I ensure the form html tags with the form method is also rendered to the page? I have attempted to do this but I don't know how to get the actual form to render, just the inputs are there in the html source code.

I know in Drupal 7 that you had to render something called child elements, but when I check for this array in Kint there is no such thing.


texts: Instructions for custom panels content types

texts:
I want to port a website from D7 to D8 that is based on panopoly and makes heavy use of custom ctools content type plugins as well as dynamic argument handling. I didn't find much useful information about doing the same thing in D8. What I found were very basic instructions about panelizing nodes and creating custom landing pages, the latter unfortunately without dynamic extraction of url arguments.

I would be happy to provide more information if necessary, but at the moment I'm primarily looking for documentation, code examples or similar that are developer oriented, and that provide more in-depth details about the APIs to be used and, if possible, a more general overview of how the pieces fit together.


texts: How to hide VBO multipage selector in a view

texts:
I want to hide / disable the VBO multipage selector above the table in my view but I don't find where to do it.

Anyone has an idea?

EDIT:
I am using the "VBO Export" module and my view is related to a media.
Here is a screenshot of the field : "Global: Views bulk operations"


texts: How can I resolve these errors when updating the module?

texts:
I want to update Drupal Commerce to 8.x-2.0-beta7 from a clean, Composer-based installation of 8.x-2.0-beta6, following the documentation on http://docs.drupalcommerce.org/v2/getting-started/update.html.

I noticed that composer update drupal/commerce --with-dependencies did not update drupal/core. This surprises me. Isn't drupal/core a dependency? Anyway, says it's white-listed so I then ran composer update drupal/core.

Now I am hitting a problem with updates.

  drupal update:debug

  Fatal error: Cannot use Drupal\Console\Core\Bootstrap\DrupalConsoleCore
      as DrupalConsoleCore because the name is already in use
      in/pathto/commerce8/vendor/drupal/console/src/Bootstrap/Drupal.php on
      line 11

  drupal update:execute

  Fatal error: Cannot use Drupal\Console\Core\Bootstrap\DrupalConsoleCore
      as DrupalConsoleCore because the name is already in use in
      /pathto/commerce8/vendor/drupal/console/src/Bootstrap/Drupal.php on
      line 11

I have since run update.php, but the Composer errors persist.

I am learning about Composer, and I don't know yet anything about Drupal Console.

What am I doing wrong?


texts: User roles and keeping their IDs when using features

texts:
I have defined some user roles and I'm assigning them to users through the rules module. I have created a feature with the rules and the roles and moved them to another site. My problem is that the user roles get new IDs and that the IDs are hardcodet in the exportet rules. Therefore the rules assigns wrong roles and I don't want to fix that each time I install the feature.

Can I somehow hardcode the user roles programatically and let the rules module work on them? Is there a better solution for the problem?

It is more or less the same problem for taxonomies that also get assigned new IDs.


texts:
We are testing out NodeSquirrel on our own palantetech.coop site, and I'm working on figuring out the best way to monitor it.

Currently we use a module that we made (https://github.com/mxroo/palante_monitoring) that works with the nagios module to monitor backupninja backups by checking the mysql dumps for viability, among other monitoring tasks.

Does anyone know of any way I could add code to that module to look at the contents of backups that are on NodeSquirrel without just downloading the whole nodesquirrel backup locally again?

My current way of checking the viability is to go through each location listed in the Drupal database as a backup migrate location, find the most recent file in that path, then check the date stamp on that file, then use strpos to search the contents for the presence or absence of specific strings, depending on whether I'm looking at a Drupal or Civi database. For Drupal the string is CREATE TABLE 'watchdog', with the logic that if that string isn't in the dump, then something is wrong, either with the site or with the backup.

My hope is to figure out a way to use strpos or some similar php method to check for the presence of certain strings in the NodeSquirrel backups. I'm pretty sure I can just use database queries to make sure the database time stamps are what I want them to be.

Cross posted from https://www.drupal.org/node/2697981

thanks,


texts:
I have a Drupal 8 site set up in Docksal. It was version 8.6.15, and needed updates to core and several modules. Bear with me - I don't have complete notes, because I thought everything had worked. I'm more than happy to debug... I just don't know where/how/what to look for in this case.

I would just roll back to a backed up version of the site. But that is missing ( My own fault)

The first problem I encountered, was not being able to update with Drush anymore. So I used composer to to attempt updating, with "composer require drupal/core --update-with-all-dependencies" - this was my first time doing so.

It didn't work. I had to update composer in order to continue on. After using "composer prohibits Drupal/core:8.7.3," I got several results, so I went ahead and updated them. I would tell you all I uploaded, but that was yesterday and I did not save those notes. Sorry. I also did an update of composer itself, all the packages. that appeared out of date. There were a couple that would not update, rejected by constraints.

Updated composer, and Drupal is now 8.7.3. I also did a bunch of module updates on the site as well.

I have an issue where the admin area shows I'm still on Drupal 8.6.15, even though Composer shows the latest version. I assumed this was a separate issue, but maybe it's related. There is an issue with this site being set up with drupal/drupal and not drupal/core. Something to do with the composer json.

Everything seemed fine, but when I tried to navigate to some of the admin pages (Content, Configuration or People page), I get an error:

  Fatal error: require(): Failed opening required '/var/www/docroot/vendor/composer/../doctrine/common/lib/Doctrine/Common/Reflection/ClassFinderInterface.php'
  (include_path='.:/usr/local/lib/php') in
  /var/www/docroot/vendor/symfony/class-loader/ApcClassLoader.php on
  line 112

Not even sure what first steps might be on this. When I type composer outdated, I don't see anything called class-loader or classfinder

Looking at ApcClassLoader.php, I see 'require $file;' on line 112:

 public function loadClass($class)
    {
        if ($file = $this->findFile($class)) {
            require $file;

            return true;
        }
    }


texts: With a standard HTML form in Drupal 8, how can I get the submit message to post in the "Status Message" block?

texts:
I have a form that I want to add JS to so that when it is submitted, the confirmation text is fired into the "status messages" block or any block in the help/admin block section.

Basically, here is the form and upon submit, I want the post message to display in a block rather than the user be sent to another page.

<form name="email_signup" action="http://example.com">
<input type="text" name="emailAddress" placeholder="Enter email">
<input type="submit" value="Join">
</form>


texts:
I have a section of my drupal website that I only want displayed to users that are logged in. So if they click on "My Page" link and the user is not logged in it should redirect them to a login screen. I have attempted to complete this task by using the following code.

<?php
if (!user_is_logged_in()) drupal_goto('user/login'); ?>

This doesn't seem to throw any coding errors but none of my links such as register, login etc work. I get an error that I have a redirect loop that will never complete. I cannot seem to find a good solution for completing this.


texts: How do I change what blocks show up on a user page depending on the user role of that page?

texts:
It is possible to filter blocks based on the user role of the current user, but I want to be able to change blocks based on roles of the user whose page I am visiting.

User 1 is an administrator so visiting

 /user/1

users see

  Administrator block

no matter what user role the current user logged in has.

if User 1 visits

 /user/4

where user 4 is RoleX they see

RoleX Block

Where RoleX block and Administrator block are both created in views.

Is there a way to do this out of the box or do I need to write my own contextual filter


texts: Update node with services doesn't work for text_list widget

texts:
I'm setting up a REST server with Drupal 7 and Services 3.x.
Everything work fine (authentication, node creation, etc..), except that I can't update a text_list field of a node.
I've tried to use &node[title]=testnode&node[type]=story&node[field_test][0][it][value]=testtting as suggested in the Services Handbook. The node is updated (I get the system message for successfully updating), all fields are updated, except the selectlist.
Anyone facing the same problem has found a solution?


texts: How to use TinyMCE 4.5 with the WYSIWYG module?

texts: I am using the WYSIWYG module on Drupal 7, but the only TinyMCE editor I can use is version 3.5. I would like to use the version found here. How can I install this?


texts: Entity reference - which side of the relationship is it best to put the field in?

texts:
I an adding entity references to an existing site with a lot of data, and I want to make sure I get it right first time. My question is - is it best practice to put an entity reference in the container content type, or in the contained content type? In other words, is it best practice for the entity reference to be in the album content type, or the track content type (also applies to team/team member, book/chapter or whatever)?

In an ideal world these relationships would be in both content types, but that doesn't seem to be built-in and the relevant module (Corresponding Entity Reference) seems to be in Alpha.  So what is best-practice?


texts: Is there a real-time inline field validation module?

texts:
Currently I'm using the Clientside Validation module for validation of my fields, but I want to be able to have per field real-time validation. Like a check thingy showing if it's correct or a small inline error when there's an error in there. I searched a bit and couldn't find a proper module.

Is there a module for that?


texts: Adding a "processed" flag to a Drupal Webform, that admins can use to indicate whether or not they've dealt with a particular submission?

texts:
We're using a Drupal Webform to accept customer requests for a free "kit" that we will mail them.

This works fine on the submission side, but we'd like a simple way to look at the submissions and tell which ones have been fulfilled, and which have not.

So far, I haven't been able to come up with a field that is visible and editable by administrators viewing the results, but not also shown to the customer when they are filling it out.

I realize I could put a checkbox on the form for "fulfilled", and then hide it from the customer with CSS... but I'm hoping there's a better way. Is there?


texts: JMeter - Load Test - Webform multiple page

texts:
I need to load test a multiple page web form in a Drupal site; using jMeter. In the test plan, I have the following:

HTTP Request Defaults
HTTP Cookie Manager
Thread Group

HTTP request (i.e. first page of the questionnaire). It includes Regular Expression Extractor to define the form_build_id
HTTP request (i.e. second page of the questionnaire).  It also includes Regular Expression Extractor to define the form_build_id

The test does not fail but no new submission get registered for the given form in Drupal.

Any idea how to load test a Drupal site with a multi page questionnaire using JMETER?


texts: Superfish - add menu item programmaticaly or simply use CSS + jQuery - Drupal 7

texts:
I have a menu in Drupal 7. It is multidomain - multilanguage, for which I use the modules i18n and Domain Access + Domain Menu Access modules. I give Drop-down behaviour with Superfish module. However, I need to add some menu items which are dependent on PHP, they are dynamic and from non-Drupal source. Is there a way of adding theme or should I use the following code:

$menu_name = variable_get('menu_main_links_source', 'main-menu');
$tree = menu_tree($menu_name);
print drupal_render($tree);

In that case, I loose the magic of Superfish module. Could I add some items on the fly without having to render the menu and still use Superfish? Or better I use the above code and finally go through the menu hierarchy and use jQuery + CSS to render the menu? I don't loose the functionality of Drupal, but because it is hard-coded solution I don't think it is adequate.


texts: How to disable "Add To Cart" button on select products?

texts:
I have a Drupal 7 / Ubercart 3 website. How can I disable the "Add to Cart" button on only some products? For instance, if I wanted to list product ABC but did not want to actually sell it online, I'd like for its "add to cart" button to either be hidden or to display a different button that would not be clickable.

The only solution I could find is for D6 (https://drupal.org/project/uc_disable_product).

Thanks!


texts: "Shopping cart form" view breaks after adding a field

texts:
I'm creating a website using the Drupal Commerce module.
The module implements a view for the customer's cart at "cart/my", listing all the items the customer added to her/his cart.

The view used to render the item list is "Shopping Cart Form".

I edited this view (well cloned it first) to add an image field owned by the product. In order to get this field in the fields' field list, I first had to create a relation called "(Line items referenced by commerce_line_items) Commerce Line item : Product" for that view.
The issue I'm having is that, when the relationship is added (and only then) to get my image field, the view completely breaks when viewed by anonymous or regular authenticated users, and only for these roles. Everything is fine when the cart is viewed by a different role (either a custom role or the administrator role).

I know it sounds crazy, but that's it...
Somehow, addind this relation makes the results found for this view to 0 (as shown in the kpr() function run from mytheme_preprocess_views) and only for anonymous and regular authenticated users. If I remove the relation from the view, all goes well again.

Could it be a permission rule somewhere that I skipped ?


texts: css file defined in .info file is not loading in Drupal 7

texts:
This is the my .info file details

name = Tripsinn
description = A flexible, recolorable theme with many regions.
package = Core
version = VERSION
core = 7.x
stylesheets[all][] = css/responsiveslides.css
stylesheets[all][] = css/style.css
scripts[] = js/responsiveslides.min.js

but these css are not loading

URL: http://dev.easysites.in/tripsinn/

this is a custom drupal theme under development.


texts: Node Post Date equals to selected date only not time?

texts: I created a view and exposed a Post Date filter. I select a date and I want to show the post of that date. But it searching based on "YYYY-MM-DD HH:MM:SS". I just want to show full day data. I set the operator is equal to.


texts: Not saving data after upgrading from 7.26 to 7.35

texts:
I recently update my Drupal site and is working fine on my local machine ie: localhost.
After uploading the site to the hosting it is not saving the form/data.
I'm not even able login to system on first attempt, it is not showing any error as well.

1 - I make sure that .htaccess files is moved to the server.

2 - I clear Drupal and browser cache several times.

3 - No javascript/jquery error on console.

4 - Check on different browsers.

I'm lost what else can be doing problem, Please guide me to the right path.

PHP info = http://worldstogethertravel.com/info.php

TIA :)


texts: Gem Install Bundle: You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory

texts:
When I run drush omega-guard I get:

  There was a problem with your setup: Could not locate Gemfile or .bundle/ directory

I have installed the Gem files through homebrew.

and when i try run bundle install again:

  Could not locate Gemfile or .bundle/ directory.

I read that you can use gulp. There is no gem folder in my sub theme so is this the correct way?

[https://www.youtube.com/watch?v=XF_LaSfua8Y&index=10&list=PLLnpHn493BHH5nnK2dKE_42l1oXA6Tq6H][1]

I am using LevelUpTuts tutorial to set up my development environment.

I think the problem is that i can not run gem install; when I run gem install bundle I get the following error.

  You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory

How do I fix this?


texts:
My Drupal 7 instance was getting slow. I realised that the problem was a cron job running. However, why is cron running when I'm browing the site? It shouldn't be, surely? It should only run when I run cron.php.

I don't have poormanscron running or anything else that I am aware of that could be kicking off cron. Any ideas of what could be causing this on Drupal 7?


texts: View filtering based on entity reference revisions (Paragraph) type

texts:
I am working on a Drupal 8.3 installation and I want to create a single content type for each organization to be able to update their own content on the site (using the core permissions on content types).

For each content type, I want to use an entity reference revision field (Paragraph) and have the view display based upon the type of entity being referenced (there will a limit of one).  I tried looking at using conditional fields (not production ready) and taxonomy term in the content type (not able to force matching of term to paragraph type).

I was hoping there was a way to build the filter criteria based on the paragraph type but only target_id and target_revision_id are selectable.

The brute force approach would require I create 6 content types per organization, but having over 100 content types seems overwhelming effort to create.  Is there another solution to keep this DRY and easily understood for novices to add content?


texts: Dynamically linking from author name(s) in a View to a nodes by author View

texts:
I need to have a View that includes an author name with each node that also links to another View showing all the nodes by that author.

Currently I've got a home page View that always shows the most recent node for a particular content type. I added the field 'display name' (a custom field I created for users) to the View so it shows 'First Name' 'Last Name', and that works well.

I also see I can make it a link in 'rewrite rules' but that would be a hard-coded link to a particular author's page. It needs to be dynamic and link to whichever author's page belongs to the author writing the particular article that will be displayed in the View block.

Anyone know how to do this?


texts: Domain Access, Revisioning with Workflow Access together in one project

texts:
I have installed drupal6.25, Domain Access, Domain Advance, Revisioning with Work flow and Grant modules. I assign node to the particular domain, but it will show access denied for all domain. If I uninstall the revision and grand modules, the node assign is working fine but the node work flow is not working properly.

Please help me...


texts: Translating a taxonomy term does not populate content into fields

texts:
When translating a node into another language it does the following:

automatically populates all fields with content from the source node on the edit form
ensures the two nodes are linked as translations
defaults to the second language (if only two enabled)

When you press 'translate' on a taxonomy term it loads a blank form (as if you are creating a new term).

How do I duplicate the behaviour of the node 'translate' link for taxonomy term 'translate' - to create the same one-click functionality?


texts: How to resolve error Font-awesome library could not be found?

texts:
For some reason my Drupal 8 installation is issuing this error after I installed and enabled Fontawesome (via the commerce module).

I don't know

I think this is the dir it is asking me to check, but all seems fine


texts:
Trying to build a content module (= a module that adds a content type) for drupal 8 but I get the following error on install, the error isnt very informative and Im stuck. The module has a image upload field, and I assume its whats throwing the error but the code for it is copied out of drupals export

  Drupal\Component\Plugin\Exception\PluginNotFoundException: The "image_image" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Code is at the following
https://github.com/ShadyRabbit/drupalIssue

Update: I found the answer myself: entity_view_display was the same as entity_form_display resulting in the error of the content type


texts: Add text after input field with form api (field-suffix)

texts:
I'm creating a form with a textfield. After the input field I'd like to have some text. Like this:

Label *
|________| some text
Field description

The code I use is:

$form['a_textfield'] = array(
    '#type' => 'textfield',
    '#title' => t('A Label'),
    '#size' => 10,
    '#maxlength' => 15,
    '#description' => t('A Field description'),
    '#required' => TRUE,
);

Is there a way do add "some text" after the input field in this way? Do I have do output the HTML code manually via #markup? Is there some way to do this via form alter? Or a theming function?


texts: Views to use relative paths for image fields

texts:
How can we tell views to use relative paths for dispalying images using image fields. I have created a views slideshow which is displaying images using absolute url which is causing the images to reload on each page load.

facing the same issue in other type of views displays like grid and unformated etc...


texts: How can I tell that my hook_nodeapi function is being called by cron and not a user?

texts:
I am attempting to filter the viewing of node/cck fields attached to the nodes, so I have written a custom hook_nodeapi function and I am editing the field values if the user doesn't have permissions (redacting them). The problem is, that when cron runs and apachesolr attempts to index the same content, cron doesn't have "the permissions" associated and so ends up indexing redacted content.

I need a simple test that returns a boolean if a function is being called by cron. Any ideas? I have started looking through cron code (Drupal 6) and it looks like bootstrap sets up cron with default anonymous user account details...


texts: Overriding page.tpl.php for a menu_hook page

texts:
I am trying to override template for a custom page I have in hook_menu.

 $items['announce_your_new_products'] = array(
    'title' => 'Announce Your New Products',
    'description' => 'Announce New Products.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('announce_new_product_form'),
    'access arguments' => array('access content'),
    'file' => 'view_new_products.pages.inc',
    'type' => MENU_CALLBACK,   );

I have read to override a specific node's page template is page--node-[nid].tpl.php and page--announce_your_new_products.tpl.php, with and without underscores, but since this doesn't have a nid I was hoping someone could point me in the right direction on how to achieve this.  I have tried page--node-announce_your_new_prodcts.tpl.php but it doesn't seem to work. Thank you.


texts:
I am used to create variants in page manager like /page/variant1, /page/variant2, and /page/variant3.

In Selection criteria there is no String URL option any longer. How do I use URLs as selection criteria?


texts: Is there a way to export the whole panelizer settings for a page?

texts:
With whole settings I mean: context, layout and content. I know how you can export the layout and context, but I do not know how to export the content.

We have several websites that share some pages in common which have widgets in the panels and we try to automate that so that our content managers do not have to do this with every setup.


texts: How to export only content, strictly core content like articles, pages, users, taxonomy ect?

texts:
How to export only content, strictly core content like articles, taxonomy ect?

Is there a way to export content only, no data about modules, only content that will work with drupal core install.

Just data that is  not affected by modules and configurations.

With Joomla I could do this via PHPmyadmin.

Any easy way to do this with Drupal 7, any module?

I see an exclude tables option in backup migrate.

You may omit specific tables, or specific table data from the backup
file. Only omit data that you know you will not need such as cache data, or tables from other applications. Excluding tables can break your Drupal
install, so do not change these settings unless you know what you're doing.

But I'm looking for an include only option, not exclude what you don't want.


texts: Simplest way to let writers edit Views headers/titles without Views UI access?

texts:
What's the simplest* way to enable non-technical writers, editors etc to edit the text in Views headers, titles, footers etc, without needing to enable Views UI on a production site, train these non-technical staff to use some of it, and grant them Views UI permissions?

It's common for content staff - writers etc - to have nothing to do with site building tools like Views UI. It's not their remit or expertise. Also, they'll usually be editting content on the production site, while site builder UI tools like Views UI are often disabled on production sites to reduce unnecessary memory consumption (less PHP files to parse for hooks).

But, the text content of the title fields, view headers, etc is within their remit and expertise. What's the simplest way to bring these text snippets - but not the whole Views UI - within their reach?

*Here, 'simplest' means minimal extra modules, minimal complexity in workflow, minimal overheads) Options using Panels are fine in my case. Ideally, I'd prefer to avoid needing to use Display Suite.

The workaround I'm using at the moment, which just about works (but I'm sure there's a simpler way) is this:

I have a custom taxonomy vocabulary, 'Text Snippets'
Each Text Snippet has a name describing to editors where in the interface it is used
Each Text Snippet description contains the HTML to be used
The views' headers are set to 'Render entity' with the ID of the appropriate Text Snippet term written in
To stop the internal-use-only term name being displayed, I have a custom template in my theme templates folder, taxonomy-term--text_snippets.tpl.php, containing nothing but <?php print preg_replace("/<p[^>]*>[\s|&nbsp;]*<\/p>/", '', $description ); ?> (the preg_replace regex removes empty paragraphs)

I'm aware of a module, Snippets, which seems to have a similar idea, but it's not at all clear what the intended usage is, there's very little information - blank readme file, documentation is only placeholders - and the very low usage stats and queue history don't fill me with confidence.


texts:
I create in administration list of some content and create link delete. On link delete I add attribute

onclick="return confirm('Are you sure?);"

but when you click "cancel" on confirm block drupal still go to link href:

http://www.supermarket.hr/#overlay=admin/categories/delete/6939/0

How can I anticipate some hidden overlay functions that ignore added confirm?

thx


texts: Wrong user's page showing up after Oauth sign-in

texts:
I have a Drupal-based site that has Twitter Oauth logins.

Today, when I was testing out the site, I logged in with one Twitter account, and it showed me the user page of another user!

I tried logging in with various Twitter accounts, and they all took me to the same user's page. I also tried it from different devices and internet connections, just to be sure it wasn't something specific to my machine, but the same problem exhibited.

Any ideas where I can look for the source of the problem?

In case this is any help: I had a problem a week ago that was due to a corrupted file, and I simply had to open the .inc file, save it, and the site was working again.

I can try that for this problem too, but I have no idea how to debug it and identify which file could be the source of the problem, as I'm not at all familiar with Drupal.


texts: Conditional display mode for entity reference field

texts:
i am having a paragraph with 2 fields :

Slider : field_gallery_slider    / Booléen
Images   : field_gallery_image   / Référence à une entité media

How could i change the media display mode if the slider is selected ?
      //the current code
      {{ content.field_gallery_image }}
         //code that would call the image with another display mode than the one choosen for the entity
       {% if content.field_gallery_slider|field_value|render=="1" %}
           //smthlike {{ content.field_gallery_image|slider }}
       {% endif %}


texts: Open the AJAX Login/Register popup when clicking on post titles

texts:
The AJAX Login/Register module adds a block with a login button. Clicking on that button opens a nice popup login/register dialog.

But how to make the login dialog open when clicking on post titles?

I tried to add a block with this code:

<a href='ajax_register/login/nojs'
   classes='ctools-use-modal ctools-modal-ctools-ajax-register-style'
   rel='nofollow'>
     My Post Title
</a>

However it doesn't work. Anyone knows why?


texts: Display nodes that reference the same node than current page

texts:
I have a Drupal 8.5.3 installation. I'm struggling to fix this, I have read many threads but none is exactly what I need, or at least I'm not being able to solve it:
I have 2 content types: A, and B. They both have an entity reference field that references to another content type, C.
I'm trying to create a block view to embed into any node of type A a list of B nodes that reference to the same C node that the current A page.

In other words:

Content type A: Cities

Content type B: Brands

Content type C: Countries

If node Rome (A) has a field that references to Italy (C), I'd like to display on it all the brands (B) that have also a field that references to Italy (C).

I have tried using relationships, contextual filters, providing default values from URL, etc. But I'm unable to make it work.
I've tried selecting my entity reference field as a relationship, and then adding a contextual filter of Content ID that uses that relationship. I have also tried some other combinations but it's not working.
I would appreciate some help!

Thank you very much!


texts: Can't attach #ajax to altered form displayed in block

texts:
I have a module that displays an existing signup form in a block.

function my_contact_block_view($delta = '') {
    switch ($delta) {

        // Newsletter signup block
        case 'newsletter_signup':
            $block = my_contact_get_emma_block();
            break;
    }
    return $block;
}

I make some minor alterations to the form. Some markup elements are removed from the form (this works), and I am attaching an #ajax property to the submit element (this doesn't seem to work):

function my_contact_get_emma_block(){
    $form = drupal_get_form('my_contact_emma_form');

    // get wrapping markup
    $header = variable_get('my_contact_emma_block_header', '');
    $footer = variable_get('my_contact_emma_block_footer', '');

    // unset some stuff
    unset($form['heading']);
    unset($form['copy']);
    unset($form['required_blurb']);
    unset($form['privacy_blurb']);

    // alter some stuff
    $form['fname']['#attributes']['placeholder'] = t('First');
    $form['lname']['#attributes']['placeholder'] = t('Last');
    $form['email']['#attributes']['placeholder'] = t('Email');

    // config to submit via ajax
    $form['submit']['#ajax'] = array(
    'callback' => 'my_contact_emma_form_ajax_submit',
    'wrapper' => 'brd-contact-emma-form',
    'method' => 'replace',
    'effect' => 'fade',
    );

    // render the form
    $form = drupal_render($form);
    $markup = $header . $form . $footer;

    // return renderable array for block
    return array(
        'subject' => t('Event Email Sign-Up?'),
        'content' => array(
            '#type' => 'markup',
            '#markup' => $markup,
        ),
    );
}

Unfortunately, it never hits my ajax submit function.  Instead the page submits to the normal submit routine (my_contact_emma_form_submit).

/**
 * Ajax callback function. (Never called)
 */
function my_contact_emma_form_ajax_submit($form, $form_state) {
  // Dummy/dumb validation for demo purpose.
  if (!empty($form_state['input']['email'])) {
    return 'Subscribed !';
  }
  else {
    return $form;
  }
}

What am I doing wrong?


texts: How can I replace BEF checkboxes with different images

texts:
Using D7, I have a view with BEF that uses checkboxes for filtering by a taxonomy term. Everything works as intended, but I want to customize the checkboxes in a very special way, and don't have a clue how to acieve this:
I want to replace the checkboxes with images and use these in a "toggle" style.
These images should not be all the same. The taxonomy terms (that these checkboxes represent) have a field_icon with an image, and I want that image to be displayed instead of the checkbox.

The normal checkbox image replacement per css does not work for me because there it is only possible to use the same one image for all checkboxes. This is not what I want, as I need different images.
The method using views-exposed-form----.tpl cannot be used because it only exposes print $widget->widget, and this 2idget cannot be themed in a more fine grained way there.

The only thing I could think of is the function theme_select_as_checkboxes($vars) in /sites/all/modules/better_exposed_filters/ which defines the html output for the exposed filters checkboxes.
But as I don't have much experience with php (I understand it and would be able to write some code with some help), and even less experience with drupal api/coding I don't really know what to do here.

Could anyone give me some advice please?
What would be an ideal solution:
In the view -> advanced -> BEF settings you can select at "Display  exposed filter as:" 4 different "formatter" types: standard, checkboxes, links, hidden
I would like to have another one like "images", ideally with the possibliity to select the image field of that taxonomy field (I know, these checkboxes must not be rendered from taxonomy... but anyway)
If not, I would just create a module (or place it into my theme?), overwrite the theme_select_as_checkboxes function and replace the default checkboxes with image checkboxes, fetching the images from the taxonomy term field, hard coded.

But this is only my vague idea of how this could be achieved - I really don't know how exactly to do that - e.g. how to access taxonomy fields from within the theme_select_as_checkboxes function...

Any help welcome, thanks.


texts: Enable CKEditor on a field with a custom widget

texts:
I have a custom widget for a field that hides the field if certain conditions are not met. My custom widget field extends the StringTextareaWidget class as a base. When it renders, my widget never displays ckeditor.

If I change the display widget to "Text Area (multiple rows)" ckeditor displays as expected.

To test my code, I commended out everything except the class declaration that extends StringTextAreaWidget, and this also prevents the ckeditor from displaying when the widget is rendered. How do I get my custom field widget to display with ckeditor?


texts: Privatemsg module shows admin and myself in autocomplete

texts: I am using Drupal 7. In the Privatemsg module my autocomplete shows myself and admin. How can I disable displaying the user who's logged in in the autocomplete and disable displaying admin?


texts: Node tagged with more than one taxonomy, how to keep expanded the specific taxonomy menu the user has used to reach a node

texts:
I have nodes associated to more than one taxonomy vocabulary, so the same node can be listed/reached in different ways, for example:

Brand > Family line > model > NODES

Veicles > category > NODES

e.g.

Ferrari > Top-Luxury > Testarossa > NODES > NODE-A

Cars > Supercars > NODES > NODE-A

By Design every node can have only and only one URL: it's ok for me (and for SEO)

Now I have created different taxonomy menus (based on the above taxonomies) to retrieve nodes in different ways:

TAXONOMY MENU A: Ferrari > Top-Luxury > Testarossa > NODE-A

TAXONOMY MENU B: Cars > Supercars > NODE-A

The question is: is there a way to keep expanded the specific taxonomy menu the user has used to reach the node?

So:

if user has reached NODE-A trough MENU A then MENU A is showed and expanded in the page

if user has reached NODE-A trough MENU B then MENU B is showed and expanded in the page

Is there a way to accomplish this?

May be using SESSION variables? (ref: http://drupal.org/node/1443210 )

Thank you very much for any help


texts: How do I render content generated by a controller in a custom block?

texts:
To render a form in a block, I can use the following code.

class LoremIpsumBlock extends BlockBase {

  public function build() {
    // Return the form @ Form/LoremIpsumBlockForm.php.
    return \Drupal::formBuilder()->getForm('Drupal\loremipsum\Form\LoremIpsumBlockForm');
  }

How can I render in a block the output of a controller? Is it possible, or do I have to duplicate the controller class code in the block class?

The example in the documentation is too simple and it shows how to render a literal string.

class HelloBlock extends BlockBase {

  public function build() {
    return array(
      '#markup' => $this->t('Hello, World!'),
    );
  }
}


texts: Why are there "template_" and "theme_" prefixes instead one?

texts: What's the difference between these ones in function names? I can overwrite each one in template.php, so?


texts: What file and folder permission changes does the Microsoft Web Platform Installer make when it installs Drupal?

texts:
I have used the Microsoft Web Platform Installer to install both Drupal 6 and Drupal 7 on my Windows Server 2008 R2 servers running IIS 7.5. (see: http://www.microsoft.com/web/downloads/platform.aspx)

I'd like to know what file and folder permissions WebPI is modifying (and why) and the web.config additions it is making so that I can manually install Drupal under IIS for those times when the default installation parameters need to be tweeked (such as where the databases are housed).

Changes made to PHP to make it play nice with Windows + IIS would also be helpful.


texts: How to customize profile2 module profile edit form using template method?

texts:
How to customize the profile edit form of the Profile2 module using a  template?

Profile2 has the main profile (admin/structure/profiles/manage/main), and it is set to provide a separate page for editing profiles (profile-main/1/edit).

In Drupal 7, for a content type such as faq, I can use a template to customized its edit form.

In template.php, I am using the following code:

function MYTHEME_theme(&$existing, $type, $theme, $path) {
  return array(
      'faq_node_form' => array(
      'arguments' => array('form' => NULL),
      'template' => 'node--faq--edit',
      'render element' => 'form',
  ),
  );
}

I then create node--faq--edit.tpl.php, where I can customize it.

What is the equivalent method I could use for a Profile2 profile edit form?


texts: What are the photo gallery/album module choices for Drupal 7?

texts:
I am looking to make a Flickr like site that user can create albums, upload photos.
With Drupal 6, this can be easily done by CCK, Node Reference, Views.

For Drupal 7, it seems difficult since Node Reference is not available yet. (There is a module called Reference, but in dev)

So are there any modules that can achieve the ugc photo albums functionality?

Thanks.


texts: Trying to modify Main menu by testing $vars['heading']['text'] == 'Main menu',

texts:
I'm trying to modify the code for the main menu only. below is my sorry code, which is not working.
it attempts to see if $variables['heading']['text'] equal 'Main menu'

function myTheme_link($variables) {
if($variables['heading']['text'] == 'Main menu') {
//put my mods here
} else {
  return '' . ($variables['options']['html'] ? $variables['text'] :     check_plain($variables['text'])) . '';
}
}

this must be close, no? i would greatly appreciate if someone could advise


texts: How to get the autocomplete feature for a taxonomy term profile field visible on the registration form?

texts:
I have Profile2 and Profile2 Registration Path modules enabled, I set up two different profiles, and for one of them I created a field which is a taxonomy term with the Autocomplete term widget (tagging).

When adding a user within the administration interface, I have the autocomplete widget working, but for anonymous users trying to create a profile the widget is not even attached to the field... I know it is not attached because a field with the widget has a "autocomplete" class and an icon for ajax status in background, but the field on the registration form has no class..

How to add this widget ? Is it a permission issue ? or adding the class to the field through hook_form_FORM_ID_alter() could be enough ? (I don't have the field in the $form array though...


texts: Having multiple Drush instances for different core versions

texts:
So in my environment, I have some websites on Drupal 7 and some on Drupal 8, and since the latest Drush 9 works with Drupal 8.4+ I was wondering if there's a way to be able to have both Drush 9 and (put another version here) to work on both major Drupal versions.

I'd like to be able to just use drush as my main alias and not define different aliases for different Drupal versions.


texts: How to get the nid of nodes created by user (on the event of logout)?

texts:
I have a  content type 'XYZ' for which the user has created nodes. Is there any way I can use to get the node ID of all the nodes created or deleted by user at the time of logout?

I am using hook_user_logout(), but I am not able to get the node IDs for the node created by the user.


texts: How to specify subdirectory for uploads in files dir when adding file field to content type via module?

texts:
This question is related to: https://drupal.stackexchange.com/questions/39884/how-to-create-file-field-instance-based-on-file-field-info-in-custom-module

If I don't specify directory I can upload file.

However if I try do it I am getting error:

  The upload directory public://osw_majatkowe_m for the file field
  field_osw_majatkowe_m_file could not be created or is not accessible.
  A newly uploaded file could not be saved in this directory as a
  consequence, and the upload was canceled.

osw_majatkowe_m is my content type stored in $type variable.

Code:

    $instance = array(
            'field_name' => $ct_info['file_field_name'],
            'entity_type' => 'node',
            'label' => 'Plik',
            'bundle' => $type,
            'required' => false,
            'settings' => array(

                'file_extensions' => '',
                'file_directory' => $type,
                'uri' => 'public://'.$type,

            ),
            'widget' => array(
                    'type' => 'file_generic',
            ),
    );

    field_create_instance($instance);

I want to have files for content type is seperate directory in sites/default/files.


texts:
After upgrading from Drupal 6 to Drupal 7 successfully, the admin menu links are disappeared.

I have carefully followed the steps to upgrade it successfully. But after upgrade, I changed the administration theme to Seven and everything was working but the administration menu. What could be the problem?

Update: Management Menu snapshot

I tried to see if the problem is with Menu, so I installed Admin menu but after that admin menu appearing. Only problem is with Drupal7 default toolbar. What am I missing?


texts: Option to set comments to Hidden on an individual piece of content (node), even when it has no comments

texts:
Drupal 8 and Drupal 9 comment fields provide three settings for the default, as configured at for example /admin/structure/types/manage/article/fields/node.article.comment:

The default value for this field, used when creating new content.
Comments
Open Users with the "Post comments" permission can post comments.
Closed Users cannot post comments, but existing comments will be displayed.
Hidden Comments are hidden from view.

But when creating or editing a node, the only options for comments are "Open" or "Closed".
Oh.  Oh.  Ok.
If there are comments on a given node, only then is the hidden option shown when editing that node.
Unfortunately, 'Hidden' also hides the "Comments" title, but 'Closed' does not— they do not have identical effect on content without comments.
OK so 99% of the time setting comments to 'Hidden' by default going to work great (neither 'Closed' nor 'Open' radio button are selected in the node's Comment settings), but then someone will hit the radio button to mark comments as 'Closed' for that content type, and then the heading "Comments" will appear, and there is no way to fix this through the UI.
The programmatic problems caused by this were addressed in Removal of "Hidden" option in comment settings form may break programmatic form submissions [#1181750] | Drupal.org.
The fact that having both hidden and closed on the default field form sets an incorrect expectation for the individual piece of content settings form was at least mentioned in Make comment settings form more usable [#989452] | Drupal.org.
But the fact that different options can and do behave differently when, even when there are no comments, has not been brought up.
Before i create or update an issue on drupal.org, am i missing something?  Is there a way to ensure that 'hidden' and 'closed' truly do work exactly the same when there are no comments yet?


texts: setting up drush AFTER drupal multisite installed

texts:
new to drupal and even newer to drush. godaddy shared hosting, I manually setup drupal 8.x multisite where one site is the host account and the rest are subdomains to it. (I didn't use the cpanel install wizard)

I just ssh'd in and setup drush but now I don't understand how to configure it to see all my sites. all the info I've seen relates to setting up drupal using drush, not configuring drush with an existing installation, especially multisite.

do I need to create aliases? any help is appreciated. thanks!


texts: how to change node edit path from node/[nid]/edit to node/[nid]/update?

texts:
I have Pathauto which changes node/[nid] to having a path of [title]; I then use subpathauto to change node/[nid]/edit to [title]/edit.

But now how can I change the edit fragment? I want to change all instances of edit to update. so the URLs would be [title]/update instead of [title]/edit.

I cannot use arguments or wildcards in Pathauto, so I cannot specify a path like */*/edit to be */*/alter, but that is effectively what I would like to happen.


texts: How do print the query which is built using search api

texts:
I have created a view using search api now i just want to print my query.But when i used hook_views_pre_execute(){
   dpq($view->build_info['query']);
}
it does not show my query.


texts: Maximum upload size for file is not working

texts: I have set file filed with 25MB Maximum upload size. But when i upload more then 25mb file it is uploading. How to stop this.Can we create any custom module for file size.


texts:
I am trying my first module on Drupal 7 on the behalf of experience on Drupal 6.

function custom_work_menu(){
  $items = array();

  $items['mypage']=array(
    'title'=>t('Title'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('custom_work_mypage_view'),
    'access arguments' => array('access content'),
  );

  return $items;
}

Upon accessing my page, I get access denied. What am I missing here?


texts:
I'm trying to create a contact form supporting HTML formatting with Webform and CKEditor. So I created a new webform with a single field of type Textarea and now I have a simple webform with the basic textarea.

How can I enable rich text formatting on this form? It doesn't work by default and I cannot find any option to enable it neither in Webform nor CKeditor settings.


texts:
I'm using Entity Metadata Wrapper and Entity Translation to programatically add a translation to existing nodes. This is my code, i'ts not working and I'm at loss to understand why:

$meta = entity_metadata_wrapper('node', $node);

$new_lang = 'fr';

$meta->language($new_lang);

$meta->language($new_lang)->title = 'Some French Title';

// Other fields are changed, but not shown here

$r = $meta->value();

$handler = entity_translation_get_handler('node',$r);

$translation = array(
  'entity_type' => 'node',
  'nid'         => $node->nid,
  'uid'         => $node->uid,
  'created'     => $node->created,
  'changed'     => $node->changed,
  'translate'   => 1,
  'status'      => 1,
  'language'    => $new_lang,
  'source'      => $node->language,
);

$handler->setTranslation($translation, $r);

$meta->save();


texts:
I apologize for asking this for the 100th time but I just cannot understand the previous answers.   There are 2 modules (form placeholder and chosen)where cannot get their libraries included.
Step 1: I downloaded their libraries and placed them in the libraries folder.
Step 2: I included 2 new libraries in the THEME.info.yml
libraries-extend:
  bootstrap/framework:
    - bootstrap_kampuster/framework

libraries:
  - bootstrap_kampuster/chosen
  - jquery.placeholder

However, neither one of the 2 is loading right now. Is there anything else I need to add somewhere? FYI, my THEME.libraries.yml looks like this;
framework:
  css:
    theme:
      css/style.css: {}
      css/animate.min.css: {}

  js:
    js/custom.js: {}
    js/misc/waypoints.min.js: {}

    dependencies:
    - core/jquery


texts: Automatic nodetitles and location tokens?

texts:
In a Drupal 7 site, I want to have automatic node titles taken from user contributed content.

I have Location 7.x-3.x-dev (enabled Location and Location CCK) and Automatic Nodetitles 7.x-1.x-dev.

The problem is location tokens in the automatic title generation tab of the content type are returning empty input. I have tried [node:location:city:?], [node:location:city:0] and [node:location:city], but all three return nothing.

Tokens from the other fields are showing their input properlu.

Any help will be greatly appreciated.


texts: I am using the Menu Block module and the Nice Menus module. In my theme's left sidebar I have a block with that menu block (2nd level). How to use a Nice Menu in that region? If I put that Nice Menu, I get 1st level menu, but I need 2nd level menu from Menu Block module who create me 2nd level +


texts: Display Suite Token Fields in Custom Block Types

texts:
I want to add a Display Suite token field to my Custom Block Type.

I have a custom block type.
I created a token field with Display Suite
Entities: Block Content
Limit field *|* or link_card|* where link_card is the machine name of my custom block type

I expect to be able to go to Manage display of my custom block type and see the token field I created, but it's not there. I have successfully made token fields and added them to Content Types.

What am I missing?

--

UPDATE: Whatever this was, it resolved itself. Shrug!