texts: hook_field_formatter_view doesn't get called

texts:
I'm kind of new to this formatter, widget system, so i hope you can help me out.
I'm trying to add a new widget to field type list_text, so i have added a info hook like this

function market_field_widget_info() {
  return array(
    'product_list' => array(
    'label' => t('Product List'),
    'field types' => array('list_text'),
    'settings' => array('size' => 40),
    'behaviors' => array(
      'multiple values' => FIELD_BEHAVIOR_DEFAULT,
    ),
  ),
);

And to my widget i have added a widget form hook like this

function market_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {

  if ($instance['widget']['type'] == 'product_list' && arg(0) == 'node' ) {

  $node = node_load(arg(1));

  $options = array();
  foreach($node->field_products['und'] as $item ) {
    $entity = entity_load('field_collection_item', array($item['value']));
    $options[$item['value']] = $entity[$item['value']]->field_title['und'][0]['value'];
  }

  $element['product'] = array(
    '#type' => 'select',
    '#title' => t('Vare'),
    '#options' => $options,
  );
return $element;
}

And this works great, i get the information into the selector that i want, but when it is posted nothing is displayed, so i added a view to it

function market_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();

  switch ($display['type']) {
    // This formatter simply outputs the field as text and with a color.
    case 'default_list':
      foreach ($items as $delta => $item) {
        $element[$delta]['#markup'] = "TEST";
      }
      break;
  }

  return $element;
}

But still nothing, am i missing something here? I have tried putting in a die, but its like the view hook is never called, hope you can help.

Best regards


texts:
In drupal.org issues when someone creates a patch, in attachment table there is a column named Test result which has a value like FAILED: [[SimpleTest]]: [MySQL] 32,869 pass(es), 2 fail(s), and 0 exception(es). and in operations column a link to re-test

What does re-testing mean? And what's meaning of the line FAILED: [[SimpleTest]]: [MySQL] 32,869 pass(es), 2 fail(s), and 0 exception(es). ?

(I'm not sure this is specific to Drupal)


texts:
This is a screenshot of the content settings area of the node administration page.  MENU SETTINGS, URL REDIRECTS, XML SITEMAP, REVISION INFORMATION, META TAGS, COMMENT SETTINGS, AUTHORING INFORMATION and PUBLISHING OPTIONS content settings do not expand when clicked and cannot be edited.

On the Views page, the upper red box shows a series of buttons instead of the dropdown that normally houses those options.  The reason the lower red box is highlighted is that when 'Update preview' is clicked, results are shown but on another page and now below.

The site generally works but this all began after removing a set of popular contributed modules.  It happened on both my local site and server site so there is some consistency there.

Does anyone know what might have caused this and how it could be rectified?


texts: How to change link to a node's path in Views conditionally

texts:
I have what I'm calling a "student blog" section. Students can create a blog either locally (with a Body field), or remotely using a Link. A single conditional_fields value of "blog is hosted" controls what is shown on the add_node_form.

These blog entries are moderated via Workbench Moderation.

Anyways in Views 3.x I want to make a listing of the blog titles, linked to their content. If the content was "local" I want a link to node/NID or the url alias. If the content was "remote url" I want the url to point to the offsite url for the blog post (eg, Blogger.com).

I have created the content type, and a simple views block that lists the node titles .... but I can't get the link(s) to point to the correct locations per entry.

If possible, please submit answers using Views 3.x Core only (not views_php, etc) ... this site has a ton of modules already :P

Images of configuration:

Content Type Fields

Initial Blog Creation Screen

Blog was Local screen

Blog was Remote Url screen

Views Block Output of Node Titles (that should link either local or remote


texts:
Is there a simple way in Drupal 8 to set a filter format on a field and not show other format options that are accessible by the role of the current user?

I want to have a field with a very stripped down editor and default to that format, but I also do not want to show the formatting options on this field. I already tried the Simplify module, not quite what I am looking for.

EDIT: Sure, you can form alter... just wondering if someone solved it in a more modular way for 8.2.x.


texts:
I have created  a customized form using the Webform module in Drupal 7, but I want to have a table with rows n columns one part of this form. I downloaded the Webform Table Element module, but there is no way to configure it or arrange the rows and columns, and mention labels as I want.

Please suggest me a step-by-step way to include a large table in webforms. How can it be managed without coding?


texts: Is it necessary to learn php in order to use drupal to manage my site?

texts:
I am planning on using Drupal to manage a website. Should I learn PHP because I understand Drupal is built on PHP language?

I don't know PHP and I am not planning to learn it, but I have decided to use Drupal as my CMS, will I still efficiently manage my geospatial data handling site?


texts:
I have a content type Advert, which have image and URL fields and I put it in a block to place it on the page.

All works fine EXCEPT when the advertiser provides a mixed case Bit.ly shortened link to their site, Drupal is converting it to lower case but Bit.ly is case sensitive and either does not find the link at all or it redirect to another . How can I force Drupal to retain the mixed case URL, at least for external URLs? The Bit.ly link is important as the advertiser uses it to track ad clicks and hence the performance of the advert on our site


texts: How do I add Webform-CiviCRM tokens into Webform emails?

texts:
The following is the HTML from a form I have created using the Webform CiviCRM Integration module.

<input class="civicrm-enabled form-text required" type="text" id="edit-submitted-civicrm-1-contact-1-fieldset-fieldset-parent-civicrm-1-contact-1-contact-first-name" name="submitted[civicrm_1_contact_1_fieldset_fieldset][parent][civicrm_1_contact_1_contact_first_name]" value="" size="20" maxlength="128">

Based on the documentation, it appears I might need to use: [submission:values:civicrm_1_contact_1_contact_first_name]

But no values are passed using civicrm_1_contact_1_contact_first_name as the field key.

Any insight?


texts: How to soley wrap the -field in a custom -wrapper in Webform 4.x?

texts:
I've a fairly simple question. Due to a given CSS I need to wrap the <input>-field (as well as <select> or <textarea>) of webform-component with a custom
-wrapper.

Change the follwoing ->

    Name
    <input type="text" id="edit-submitted-title" name="submitted[title]" value="" size="60" maxlength="128" class="form-text required">

to ->

    Name

         <input type="text" id="edit-submitted-title" name="submitted[title]" value="" size="60" maxlength="128" class="form-text required">

I tried this snippet (changing #prefix and #suffix with hook_form_alter()), but it wraps the whole webform-componoent in a custom div.

Result is like this:

        Name
        <input type="text" id="edit-submitted-title" name="submitted[title]" value="" size="60" maxlength="128" class="form-text required">

I also tried to modify #field_prefix and #field_suffix with, but it doesn't result in any output at all. It seems, that these doesn't allow to have any custom html in it.

Any suggestions? Thanks.


texts: Show Colorbox or other Modal Window on page load

texts:
I'm working on a module that shows a modal window of some sort (I've used Colorbox so far, but I'm not attached to it) upon page load. I've gotten to the point where I need to make it display on page load and am now a little bit stumped how I'd do that -- any ideas? Using D7, btw.

Thanks!


texts: Adding multiple taxonomy terms to a single node programmatically

texts:
I have the following iteration:

  foreach($category as $cat) {
              insert_term_if_not_exists($cat, 'tags');
              $term_tags = taxonomy_get_term_by_name($cat);
              $tid_tags = key($term_tags);
              $lang_tags = field_language('node', $node, 'field_tags');
              $node->field_tags[$lang_tags][0]['tid'] = $tid_tags;
            }
          }
       }
  node_save($node);

which relies on the following function to create non-existent taxonomy terms:

function insert_term_if_not_exists($term_name, $vocabulary_name) {
  $vocabulary = taxonomy_vocabulary_machine_name_load($vocabulary_name);
  $matched_terms = taxonomy_get_term_by_name($term_name, $vocabulary->machine_name);
    if(empty($matched_terms)) {
      $term = new stdClass();
      $term->vid = $vocabulary->vid;
      $term->name = $term_name;
      taxonomy_term_save($term);
    } else {
      $term = array_shift($matched_terms);
    }
return $term;
}

This couple pieces of code work great to create new taxonomy terms (taken from $category array) and to associate a node with the last taxonomy term. And I need to add all of the taxonomy terms which went through iteration above to the node.

Looking everywhere to find proper instructions to add multiple taxonomy terms to a single node programmatically without much success. Hope someone here can point me to the right direction, thanks!


texts: How to use entity full path instead relative path

texts:
Following Drupal entity used in editor and called in JSON API in body field.

<drupal-entity alt="Blog Post Image" data-align="center" data-embed-button="media_browser" data-entity-embed-display="media_image" data-entity-embed-display-settings="{&quot;image_style&quot;:&quot;&quot;,&quot;image_link&quot;:&quot;&quot;}" data-entity-type="media" data-entity-uuid="111f85db-99f7-4430-aa9b-ad644be8bc23" data-langcode="en" title="Blog Post Image"></drupal-entity>

Json Response:

[{
    "title": "Use Drupal img src with full url ?",
    "body": "Here is image which came with /relative-path.jpg, <img src=\u0022\/sites\/default\/files\/2019-12\/image28-8fc299e2b382af7f3d188613d4b66933.jpg\u0022 /> "
}]

Is there any setting in Drupal admin panel to set full eg: http://cms-api.local/sites/default/files/2019-12/image28.jpg instead /sites/default/files/2019-12/image28.jpg

Details:

Drupal domain: cms-api.local
Frontend API: project.local:8000/


texts: Is in Drupal the way to cache whole region?

texts: I have a region which contain several blocks, each of them is changed rarely. I want to cache whole region (for each user), but i can not find the solution. Watching into the sourses gives no result too. Is anybody who knows is it possible, and how to do that? Thank you for every answer!


texts: How to hide title of any content type without using a module?

texts:
I want to hide the title field of a particular content type (such as Article), but without using any modules.

How can I do this?


texts:
I have a small problem on D7, I need to alter the login form inside block (add class to inputs, placeholder and submit button text, custom pass reset and login links) im using hook_form_FORM_ID_alter. I don't need to use custom module.

block id = block-user-login, form id = user_login_block

My theme.php code

function themename_form_user_login_block_alter(&$form, &$form_state) {

    $form['name']['#attributes']['placeholder'] = t( 'Username' );
    $form['pass']['#attributes']['placeholder'] = t( 'Password' );

   // custom register link
    $form['actions']['signup'] = array(
        '#markup' => l(t('Register'), 'user/register', array(
            'attributes' => array(
                'class' => 'top-user-block-link register',
                'title' => t('Create a new user account.')
            )
        )),
    );

    // custom reset password link
    $form['actions']['request_password'] = array(
        '#markup' => l(t('Forgot my password'), 'user/password', array(
            'attributes' => array(
                'class' => 'top-user-block-link new-password',
                'title' => t('Request new password.'),
            )
        )),
    );
}

Links for password reset and login links renders fine, but i can't make the placeholders or class add to work.

i've tried to use

function theme_form_alter(&$form, &$form_state, $form_id){
  if ($form_id === 'user_login_block') {
$form['name']['#attributes']['placeholder'] = t( 'Username' );
    $form['pass']['#attributes']['placeholder'] = t( 'Password' );
  }
}

but i works only on /login page.


texts: WHen I delete products andvariations via VBO some are still left

texts:
I delete all my products and also the variations were deleted at the same time

but still after VBO delete under commerce/#overlay=%3Fq%3Dadmin%252Fcommerce%252Fproducts

some products are still left

why? I am attaching the image, there are empty products without variations inside that I cant delete

why is this happening?


texts: colorbox does not seem to work anymore after upgrade from 7.x-1.6 to 7.x-2.9

texts:
I upgraded colorbox from 7.x-1.6 to 7.x-2.9 and now, I lost functionality of loading the pictures in a box. my page is http://www.quaaoutlodge.com/content/lodge and the centered picture in the middle, used to load nicely in a colorbox frame before the update but this does not work anymore now. The link looks like:

The link is being "auto-created" as follows:
In my Content type, I have added a Field myImage that allows me to upload and insert the image into the content. The Format of the field, I set to Colorbox. I setup my image styles as follows:

Content image style: Hide
Colorbox image style: Original image
Colorbox gallery type: Per page gallery
Colorbox caption: None

And don't understand how this isn't working anymore after the upgrade...
Whaty's wrong with this I'm wondering? Should I rollback to 7.x-1.6 or can I fix this?

EDIT A
The colorbox module is installed & enabled and it says A light-weight, customizable lightbox plugin for jQuery 1.4.3+. Looks like I'm using jQuery 1.4.4:

EDIT B
I just copied modules/colorbox/ to libraries/colorbox/ but that didn't change much. You say the "JS lib" is not included on the page? I have

and

in my source code, the second line refers to jQuery 1.8


texts: invoking a block and attaching it to a specific html element

texts:
I have been having this problem for quite some time now and I don't know how to proceed.

I am trying to get a block by invoking it, the simple way:

 $block2 = module_invoke("module", "block_view", "nameofblock");
  print $block2["content"];

and insert it after a specific div with a unique id.

I tried using JavaScript and jquery:

(function($,Drupal,window,document,undefined){$(document).ready(function(){
$('#page-title,page').append('#invokedblockid');
 });})(jQuery,Drupal,this,this.document);

//and

document.getElementById("page").appendChild(document.getElementById("invokedblockid"));

//and all these

(function($) {

$(window).ready(function() {
$("page-footer-wide").detach().append("page-title");
$("#faresisgod").insertBefore("#page");
$("#faresisgod").appendTo("#page");
});})(jQuery)

but still the block is rendered where i originally added it, and if i put php inside of javascript, the new block will return a  and close my script prematurely...

so is there a way to show this block in the specific div id by using javascript/jquery or is there a way to use php aray to check for the required id then invoking the block.

this is giving me a headache for quite sometime and i am out of options.

thanks in advance


texts:
I'm using Drupal 8 with Webform module.

I want to allow users to upload one or several files when filling the form. Is it possible with Drupal 8? May be some additional module required for this?


texts: How to make a parent - child taxonomy list

texts:
How can I make a category page displaying all my 100+ taxonomy terms in a parent/child way (something just like http://www.dmoz.org/)?

-parent
--child
--child
-parent
...


texts: How do I get hex value for field categoryhex on creating category?

texts:
I want to create a new category to my Drupal site but I need to set an categoryhex but I don't know which value I need to set here.

Thanks for your help.


texts: Exported menu blocks to a feature module via FE block they are not created - Why?

texts:
I am using menu blocks and context to create menus on a site.  I have created the menu blocks and added contexts for there use (they are working on my local dev).  I have exported the menu blocks to code using fe block and strongarm per the recommendations in Drupal.org I am doing the following after versioning the code to git and pulling it to the new server:

drush fr <feature_module>
    "Do you really want to rever variable? (y/n) y
$ Variable reverted
    "Do you really want to revert <feature_module>? (y/n) y
$ <feature_module> revert

I clear the cache, go into the new site->admin->Structure->Features-> and the variables are listed under strongarm and the menu_blocks are listed on Block settings.

But the menus are not showing on the page.  A look in blocks and the menu are not there.  It appears they weren't built.

Am I missing a step?  Please help.

Thank you in advance


texts: Drupal images/links at the wrong URL(sometimes)

texts:
I have a Drupal website installed on cPanel.
the site is at http://example.com

Everything is working good, however at times, sometimes the images/links will be changed to a different URL then the main url, it will be at https://randomurl.com

The images/links still work fine under the new url, however I would prefer it not go to the new url, as i am selling that url shortly.

i have went into settings.php and added $base_url to the main url, but nothing have changed.


texts: Getting the node id from the node containing an entityform in submit handler

texts:
I'm using the module EntityForm to build a form. This EntityForm will be an entity reference field in the content type ShowForm. ShowForm contains the form and some other fields that give some information about what the form will be used for.
Once the EntityForm is filled in, they should be redirected to the ShowForm-node that contained it so they can fill it in again (for someone else). There will be different ShowForm-nodes that all have a reference to this EntityForm, but I have to redirect them to the specific ShowForm-node they filled in the form on.

I've added an extra submit button and submit handler that submits the form and redirects them to a ShowForm-node so they can fill it in once more.
The problem is that I can't find a way to redirect them to a ShowForm-node without hardcoding the id (so it's only useable for 1 ShowForm-node).

For example:

$form_state['redirect']='node/123'

where 123 is the nodeid of the node showing the EntityForm. I'd like to be able to get the nodeid dynamically for redirecting instead of manually putting in '123'.

This is my code so far:

function extra_inschrijving_form_alter(&$form, &$form_state, $form_id){

    if ($form_id == 'generiek_inschrijvingsformulier__entityform_edit_form'){
        $form['submit2'] = $form['actions']['submit'];
        $form['submit2']['#value']='Inschrijven en ook een broer inschrijven';
        $form['submit2']['#weight']=100;
        $form['submit2']['#submit'][1]='extra_inschrijving_default_wp_submit';
    }
}

function extra_inschrijving_default_wp_submit($form, &$form_state){
       //Do some stuff

      $node_id=???
      $form_state['redirect']='node/' . $node_id;
}

Is there a way to get the right value for this $node_id? Is it possible?

(I was thinking about adding a hidden field to the EntityForm and using rules to set it with the nodeid of ShowForm when a ShowForm-node is created, but I can't seem to acces the EntityForm's fields in rules even when I use "has field"-conditions)


texts: Form incorrectly displays differently depending on logged in user's role

texts:
All logged in users can add a forum node. The current topic is determined by a field in another node (nid=77) and set to the default value for the node being created by this form.

While this all works perfectly for admin users, authenticated users see only '- Select a value -' as the default value. I verified with set_message that the code obtains the correct default value of the taxonomy term. What could be causing this? Note in case of authenticated user, <option value="_none"> is the only item in the select list. For admin user, the select list contains all of the taxonomy items with the correct option value set to selected="selected".

use Drupal\taxonomy\Entity\Term;
use Drupal\Core\Form\FormStateInterface;

function MYMODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  if ($form_id != 'node_forum_form') {
    return FALSE;
  }
  else {

    $nid = 77; // Node ID 77 contains this week's topic in field_topic
    $node = \Drupal::entityTypeManager()->getStorage('node')->load($nid);

    $current_topic_id = $node->get('field_topic')->getString(); // get the TID
    $term = Term::load($current_topic_id); // load the term from the taxonomy
    $the_topic = $term->getName(); // get the Term Name for the debug message

    $form['field_topic']['widget']['#title'] = 'The Current Topic';
    $form['field_topic']['widget']['#default_value'] = $current_topic_id;
    $form['field_topic']['widget']['#disabled'] = TRUE;

    drupal_set_message('current_topic_id: ' . $current_topic_id . ', termName: ' .  $the_topic);

    return $form;
  }
}

For admin role, developer tools show <option value="44" selected="selected">Name of the entity</option> as well as all the other values/names of taxonomy items.

For authenticated user role, only one item is listed, <option value="_none" selected="selected">Select a value</option>.


texts: Query Database to Fill Dropdown Form API #states

texts:
I am trying to develop a pretty complicated form. Essentially the user selects from Education, health, or water quality. Then using states the correct follow up questions are asked before all this data is submitted.

However, whenever I try to populate with a db query it acts funny. For example. Health and Education but have a dropdown select for years. Each should load the years available from the database and populate accordingly. However, the health dropdown select for year (which comes after the education) populates its self with the education's years. If I do a dpm to see what year the health year query gets, it is right, but it does not display on the dropdown.

I hope that makes sense. To sum it up: I have two queries to populate two different year forms. However, both populate themselves with the first query, even though the second one returns the right variables.

Here is the code:

$form['data_set'] = array(
    '#type' => 'select',
    '#title' => t('Please Select a Topic'),
    '#options' => array(
        'education' =>t('Education'),
        'health'    =>t('Health'),
        'water'     =>t('Water'),
    ),
    '#required' => TRUE,
);
// If User Selects Education
$form['education'] = array (
    '#type' => 'fieldset',
    '#title' => t('What Education Information are you looking for?'),
    '#states' => array(
        'visible' => array(
            ':input[name="data_set"]' => array('value' => 'education'),
        ),
    ),
);

    //Query DB for Rows
    $query = db_select('hp_education_years');
    $query->fields('hp_education_years', array('id', 'years',));
    $query->orderBy('years', 'ASC');
    $results = $query->execute();

    //define rows
    $options = array();
    foreach ($results as $result) {
        $options[$result->id] = array(
            $result->years,
        );
    }
    $form['education']['year'] = array(
        '#type' => 'select',
        '#title' => t('Year'),
        '#options' => $options,
        '#states' => array(
            'visible' => array(
                ':input[name="data_set"]' => array('value' => 'education'),
            ),
        ),
    );
    $form['education']['level'] = array(
        '#type' => 'select',
        '#title' => t('Level'),
        '#options' => array(
            'primary' => 'Primary',
            'jhs' => 'JHS',
            'shs' => 'SHS',
        ),
    );
    $form['education']['sector'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Sector'),
        '#options' => array(
            'public' => t('Public'),
            'private' => t('Private'),
        ),
    );

//if user selects health
$form['health'] = array (
    '#type' => 'fieldset',
    '#title' => t('What Health Information are you looking for?'),
    '#states' => array(
        'visible' => array(
            ':input[name="data_set"]' => array('value' => 'health'),
        ),
    ),
);

    //Query DB for Rows
    $query1 = db_select('hp_health_years');
    $query1->fields('hp_health_years', array('id', 'year',));
    $query1->orderBy('year', 'ASC');
    $results1 = $query1->execute();

    //define rows
    $options1 = array();
    foreach ($results1 as $result1) {
        $options1[$result1->id] = array(
            $result1->year,
        );
    }
dpm($result1->year);
    $form['health']['year'] = array(
        '#type' => 'select',
        '#title' => t('Year'),
        '#options' => $options,
    );


texts: Conditionally assign a custom role on user registration

texts:
I've written a custom module that uses hook_form_alter() to set some default values from GET-parameters when the user registration form is called with certain GET values. That is, if you call mysite.com/user/register?firstname=Derp you'll find that the form field "Firstname" is magically filled with "Derp".

Now here it comes:
When a specific GET value is given, then and only then I'd like to automatically assign an existing custom role to the new user. That's not to be achieved with Rules and the like. (Yes, I know that anyone with even small insight in programming may exploit this to get the role, but the role is not really important).

I've tried to update the register form values with:

$form['#user']->roles[] = 'customRole';

A var_dump($form) gives:

    ["#user"]=>
  object(stdClass)#111 (4) {
    ["uid"]=>
    int(0)
    ["hostname"]=>
    string(14) "myhost"
    ["roles"]=>
    array(2) {
      [1]=>
      string(14) "anonymous user"
      [2]=>
      string(9) "customRole"
    }
    ["cache"]=>
    int(0)
  }

...but it seems that this data gets sorted out during the processing of the form. Thus the role is not assigned.

Alternatively I could assign the role directly using user_multiple_role_edit(), but I need the uid for that, which in turn is assigned during user_register_submit(). That function however seems to be beyond the reach of any API function I've found so far.

I'd be glad to read about your thoughts how I could assign the role on registration (to say it again: Rules doesn't do the job). Thank you.


texts: Make a Search view have the same options as a Content view

texts:
I have created a Content view that works perfectly, believing I would later add facets to it once Solr is up and running.

Now that Solr works together with Search API, I realize that to use facets I need my view to be a Search view.

Unfortunately now with the view being a Search view I can no longer use:
Contextual filter - Content: Has taxonomy term ID (with depth)
Relationship - Flags: my flag (by any user)
Field - Flags: Flag link
Field - Computed fields: (values are all 0)
Field - Content: Path (Found a work around for this one)

Is there a way to make my Search view behave like a Content view and therefore have access to all needed functionalities?
Or may be could I use facets on my Content view? None of my tests worked though.


texts: Create Drupal Commerce stores as a Service

texts:
I'd like to leverage the power of Drupal Commerce to sell completely unrelated products and thus would like to create 2 different stores and brands. I could of course create a Drupal multisite but this is overkill and I really want to have only one site and one Drupal Commerce setup. If tomorrow I want to create new stores, I'd be able to do so with this layout without having to go through the headache of managing different installs.

My idea is thus to try and set up Drupal Commerce as a service with the following in mind:

Each store would be completely isolated from the others (products,
clients...)
Provisioning a new store would only be a matter of assigning a role to a new user
Say the root domain is mysite.com, I'd like to have one
store at mysite.com/store1 and the other at mysite.com/store2 (using
subdomain would be pretty much the same)

I've been thinking about using Organic groups but it's not obvious to me if a) it is the right tool and b) how to achieve that with the module.

Any pointer or feedback would be very much appreciated.

Thanks!


texts:
I am trying to create nodes from information extracted from a SQL query by using the following:

db_set_active('sage');
$query = db_query('SELECT CLIENT_ID, MASTER_CLIENT_ID, PARTICIPANT_ID FROM sage.CLIENT');
$result = $query->execute();
foreach($result as $record) {
  $node = new stdClass();
  $node->title = (string)$record->participant_id;
  $node->client_id = (string)$record->client_id;
  $node->master_client_id = (string)$record->master_client_id;
}

However, from my echo statements, I can see that my code never even enters the loop.

I had thought that execute() returns me an object of the query to loop over, but I guess I was wrong.

Could someone please tell me how I can loop over the results of my query and get the fields?


texts:
I'm trying to retrieve all Forums on a Drupal 7 site, using the Services module.

I can get a list of all "forum topics" (which I think of as forum entries or forum posts) this way:

curl -i -X GET \
  -H Cookie:SESSedeadbeef=B0ZkiW3-U2x93yJU-jusjw6A-SgeShSNTYEkG \
  -H Accept:application/json \
  'http://myserver.com/rest/node?parameters\[type\]=forum'

How can I get a list of all the Forums? The parent containers for those posts?

Also, where is the documentation on the Services module?  I am having trouble finding anything.


texts: Changing proxy settings and making them effective

texts:
I'm running a Drupal training course at work. For the exercises I've set up an Ubuntu Server VM (with Unity GUI) using VirtualBox. This allows me to port the VM around between my home workstation (with no proxy) and two work locations (each behind different proxies).

Since we work in French, the exercises make extensive use of translations for the various modules installed.

Drupal accesses the Internet from the server in the following different ways:

drush downloads of modules
drush pm-updates
UI verification of module updates
UI verification of translation updates (using l10n_update module)
drush verification of translation updates (also using l10n, but with commands)

Every time I make a change to the VM in one location I have to update the proxy settings in the others, and I'm having great difficulty in working out how to do this. Proxy settings seem to be in three places:

/etc/wgetrc - this changes the wget proxy settings, and it seems to work fine for drush dl and drush pm-update, but does not get taken into account by the UI or drush translation updates
in settings.php: here it seems to be possible to set them in either Drupal-7 format, like so:

$conf['proxy_server'] = '10.154.61.3';
$conf['proxy_port'] = 3128;

or in Drupal-8 format, like so:

$settings['http_client_config']['proxy']['http'] = '10.154.61.3:3128';
$settings['http_client_config']['proxy']['https'] = '10.154.61.3:3128';
$settings['http_client_config']['proxy']['no'] = ['127.0.0.1', 'localhost'];

You can also install a module called http_proxy, and this puts the settings directly into Drupal variables in the database (in the 'variable' table).

What's been bugging me is getting the proxy configuration changes to work. I get into situations where drush works for downloads and module updates but not for translation updates, and the UI doesn't work at all.

Of course, some of this is due to the imponderables of proxy settings (impossible to know what the settings are, and they change unpredictably - at one point for example I had to use the user agent settings).

But I have some questions I'm hoping someone might be able to answer:

What operations exactly do drush dl, pm-update, l10n-update, and the
UI equivalents use? Are there differences that might cause one to
work and others not?
Do both the D7 and the D8 formats in
settings.php work?
What is the difference between using settings.php and the variables in the database?
How do the database variables get updated? Does the fact of changing them in settings.php also update the database?


texts: how to add a cck field for youtube embed code?

texts:
I have created a content type. I want to add a cck field to the content type where I can paste the youtube video embed code.

So that when I display the value of that field, a youtube video should display where I should be able to click on the play button and the video should play then.

Any module or any other idea for this problem?


texts: Left and Right region is not showing on ZEN sub theme

texts:
I've been working right now on a custom sub theme via ZEN for a certain Drupal site. I had it first developed in my localhost. Right after I had the half of the basic design implemented, I uploaded it immediately to the site and had it enabled. Now, something is wrong. The two regions are not showing up when I tried to view them on the block administration page. Even if I put a block on each of them, still they don't display on the page... what could it be?

In my localhost, it's working fine. I'm not sure why it's not working well on the live site. Has anyone of you experienced the same issue? Any help or suggestion is very much appreciated.

thanks in advance.


texts:
I want to build a map that has multiple control selectors above the map. When one icon is selected, it prints the relevant markers all over the globe on the map.

If one of the control selectors appears at any one location it just shows one marker, but if two or more different control selectors are clicked on and they share the same location, the marker is modified and expands.

In essence this is something "like a heatmap" function, but not quite.

Anyone had a similar project that can relate and perhaps set me on the right path?


texts:
Using Drupal 7.22, Geshi filter 7.x-1.2 and libraries 7.x-2.1

Checked a checkbox "use Geshi filter" in a FULL HTML filter, but still when i'm trying to use something like that:

<php>
echo 'some code'; // not highlighting at all :X
</php>

Not highlighting at all, it just print echo 'some code'; not just some code, because its not working, any suggestions?


texts: Drupal 8: Webform - how to programmatically prevent or call a form submission?

texts:
I build a form with the webform module and hooked it to be able to submit it via AJAX:

function mytheme_form_alter(&$form, FormStateInterface $form_state, $form_id)
{
  if ( isset($form['#webform_id']) && $form['#webform_id'] == 'myform' )
  {
    // add an AJAX callback to the form submission
    $form['actions']['submit']['#ajax'] = array(
      'callback' => '\Drupal\mymodule\Controller\DefaultController::submitMyForm',
      'event' => 'click',
    );
  }
}

Now i'd like to prevent the form submission in the submitMyForm-function when a certain condition takes place. How can I achieve that?

And how can I submit it when the condition doesn't take place?

EDIT

This worked:

function submitMyForm(&$form, FormStateInterface $form_state, $form_id)
{
   if ( $condition ) {
      $form_state->setErrorByName('field_name', t('error message'));
   }
}


texts: How do I go about creating a paid subscription product with Drupal Commerce?

texts:
I am trying to set up a paid subscription to an email list using Drupal Commerce with payment via PayPal.

One of the way I came up with is upon completion of an order, a user will be redirected to a subscribe page and her role will be updated to view the form.

I am looking for pointers to functions, existing modules or any advise on how to achieve this.

Thanks,

~ahimsauzi


texts: When trying to install a new module, receive errors, how to fix that?

texts:
Warning: fileowner(): stat failed for temporary://update_ZKRfRZ in update_manager_local_transfers_allowed() (line 932 of /home/u793804839/public_html/modules/update/update.manager.inc).
Warning: move_uploaded_file(temporary://google_map_field-7.x-2.17.zip): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in drupal_move_uploaded_file() (line 1642 of /home/u793804839/public_html/includes/file.inc).
Warning: move_uploaded_file(): Unable to move '/tmp/php11lDO0' to 'temporary://google_map_field-7.x-2.17.zip' in drupal_move_uploaded_file() (line 1642 of /home/u793804839/public_html/includes/file.inc).
File upload error. Could not move uploaded file.
Warning: fileowner(): stat failed for temporary://update_ZSt84Z in update_manager_local_transfers_allowed() (line 932 of /home/u793804839/public_html/modules/update/update.manager.inc).


texts:
I have gone through the install steps located here: http://drupal-bootstrap.org/api/bootstrap/docs%21Sub-Theming.md/group/sub_theming/8 for a fresh install of drupal 8 with bootstrap, but every time I have come to get the same issue, my navbar looks like this:

yet when I set my default as the standard bootstrap theme, everything is perfect. I don't see any errors in my console either.


texts:
I am using the latest release of Drupal Commons and I have Private Files configured and working.

I would like to allow users to upload files to their individual user profile, which only the individual user can view/download after upload. For example, a user may upload 3 files to their profile, but these should be private and not visible or accessible to any other site user.

With Private Files configured, I thought this may be possible via a File field on the user profile, but I have been unable to restrict view to the document owner.

Has anybody acheived a similar result with Commons (with or without addional modules)?

Thank you


texts:
What hook would I use to add a new content status under the path admin/content?  See image below.

I am trying to give my content type(s) a new status so that I can do some more filtering on it.  Specifically, I want to create a new "draft" status.  Any pointers on where to start and API's to look at?  Or are there any existing modules that do this that I can take a look at the code?

EDIT: I would like the user filling out the form to set their own status as 'draft'.  The reason is that I am using the save_draft module (http://drupal.org/project/save_draft) that allows the user to save values in a form without submitting it.  The problem is that Drupal considers the node to be unpublished.  My editors should not see the content type if it is in "draft" mode, but since Drupal saves it as "unpublished", my editors see this and they are not sure if the content is ready to be edited or if the end user is just saving their work and finishing it up later.

The save_draft module gives me 2 buttons (Publish and Save as Draft).  This allows the user to select their own status.  I would also like this new "save as draft" status to be searchable/sortable so my editors could find out who hasn't finished submitting their unfinished draft, if need be.


texts: Only require comment approval when an image is attached

texts: I am working on a project that allows user commenting without administrator approval if they post only text; however, if the user decides to attach an image to their comment, the comment should require approval first before being published. What is the best way to approach this?


texts: Drupal 8, get value of field user in proper way, not an array

texts:
In a custom module, I load an user and I want get some field value

I do this :

$value = $user->get('field_value')->getValue();

but $value contain an array, not the value. I must do ugly command for get the value:

$value = reset(reset($user->get('field_value')->getValue()));
// or
$value = $user->get('field_value')->getValue()[0]['value'];
// $value = 4

There isn't any Drupal way for get the value of a field, not an array ?

Thanks =)


texts: Is possible to have mutiple email for a user?

texts: Is possible by default in Drupal 7 to have more than one email associate for a user ?


texts: How to programmatically take a quiz with multiple questions

texts:
I have one quiz with multiple questions.I got a solution for taking quiz with multiple questions.

$account = user_load($quiz_taker_uid);
// Load quiz and question nodes
$quiz = node_load($quiz_nid);
$question = node_load($question_nid);
// Create a new result id
db_query("INSERT INTO {quiz_node_results} (nid, vid, uid, time_start) VALUES (%d, %d, %d, %d)", $quiz->nid, $quiz->vid, $account->uid, time());
$rid = db_last_insert_id('quiz_node_results', 'result_id');
// Submit the answer
$result = quiz_question_evaluate_question($question, $rid, $long_answer_text);
quiz_store_question_result($quiz, $result, array('set_msg' => FALSE));
// Finish the scoring and properly invoke hooks
$score = quiz_end_scoring($quiz, $rid);
quiz_end_actions($quiz, $rid, $score);

change one line in above code // passing the number of question .

quiz_store_question_result($quiz, $result, array('question_data'=>array('number' =>1)));

But I  got another problem. score could not be updated.


texts: How to stop autosuggest in node author field and write our own?

texts: Is there anyway to stopping auto suggest in author field of node content and write our own author names instead of users??


texts: Is Drupal contact form securely encrypted?

texts: In Germany, it is mandatory to by law to use secure contact forms (secured by TLS for example) when you are a website owner. Is the Drupal 7 contact form secure in this regard?


texts: Best location to keep the javascript files in drupal 7

texts:
I am using javascript for some of the html pages.
Where should I store the javascript files in my drupal folder.


texts: Trying to create a user with an entity reference taxonomy term using services

texts:
So I've been trying to create a user with an entity reference taxonomy term, however for some reason it doesn't seem to work.

I've noticed that it depends on the widget used, but I've tried every combination of widgets and data, and it doesn't appear to work.

Here's an example of one way:

                    "field_likes": {
                        "und": "1"
                    }

I've also tried this, also for example:

                    "field_likes": {
                        "und": [
                            {
                                "target_id": 1
                            }
                        ]
                    }

Is there anyway to add taxonomy terms as an entity reference on a user that will work? Has this changed, or am I doing something wrong?


texts: How do i post/donate a module in drupal.org?

texts: I have a module that i have developed, and I want to post it on drupal.org to be available for other developers to download. How do I do that?


texts: How can I resolve my CGI error during installation of Drupal 7 on WinXp?

texts:
I'm installing a local instance of Drupal 7 on my WinXp machine. PHP 5.4 and MySql 5.5 are installed already.

I've unpacked the downloaded Drupal 7 site files into a virtual directory and used IIS 6 to make this directory a PHP site.

However, the result is not encouraging:

  CGI Error The specified CGI application misbehaved by not returning a
  complete set of HTTP headers. The headers it did return are:

  Could not open input file: Files\PHP\php-win.exe

The web address I'm using is:

http://localhost/drupal7/install.php

Where "drupal7" is the name of my application in IIS.

Any ideas on what the problem might be?


texts: Prevent "→" from being written in URL alias

texts:
When the post title contains "→," it will be written in the URL alias.
When using Boost, an URL containing "→" will not be well cached; visitors will see the uncached node.

How do I prevent the "→" character from being written in URL aliases?


texts: Translate homepage meta Title and description

texts:
I have a Multilingual Drupal 7 site using i18.

But how do I get my homepage meta Title and description translated?


texts:
How can I create a new user account through a URL?

Basically I have build a new simple site with Drupal 8. Direct registration is not possible, but it should be managed by a third party service. This service can only call URL in the format http://mysite/user/register?name=abc&password=def.


texts: Upgrade rector and Drupal check fail with "ambiguous class" errors on unrelated modules

texts:
I am running Drupal Core 8.9.11.  I have custom module I need to upgrade to run under Drupal 9.  Installed Upgrade rector.  When I run it on my code it fails, returning errors on unrelated
modules:
Rector v0.7.29
Config file: ../../../../../../tmp/upgrade_rector/upgrade_rector.yml
In RobotLoader.php line 186:
Ambiguous class MYPDF resolution; defined in /var/www/html/websites/drupal8
/master/modules/printable/vendor/tecnickcom/tcpdf/examples/example_003.php
and in /var/www/html/websites/drupal8/master/modules/printable/vendor/tecni
ckcom/tcpdf/examples/example_011.php.
BTW, the above module isn't even installed in my Drupal project.
So, I deleted the "printables" module directory, ran upgrade rector again,
then got this:
Rector v0.7.29
Config file: ../../../../../../tmp/upgrade_rector/upgrade_rector.yml
In RobotLoader.php line 186:
Ambiguous class Drupal\swiftmailer\Form\MessagesForm resolution; defined in
/var/www/html/websites/drupal8/master/modules/swiftmailer/src/Form/Message
sForm.php and in /var/www/html/websites/drupal8/master/modules/contrib/swif
tmailer/src/Form/MessagesForm.php.
Note that I get the exact same errors when running Drupal Check from command line.
.. Steps to reproduce
Go to Upgrade Rector page: /admin/reports/upgrade-rector
Select my custom module as project.  Click on Run Rector.  I get "Fail while
processing my module" with above errors.
How do I get upgrade rector to run on just the one module in question and not
unrelated modules?


texts: how to load more than one content type form in one single form

texts: i have a book site, where users can upload book details including Author details and i want all this to be captured in one form, but stored separately i.e Author details and book details and i should be able to reference the author in the view display.i don't know how best to describe this but the link to the site is naijabooker.com and the form is at http://naijabooker.com/premium-book, the output dispaly link is at http://naijabooker.com/title. thanks for anticipated help this is a drupal 7 site


texts: Cached variable remains after truncating cache table

texts:
I updated a row in the variables table to change the value of a variable. Then I truncated the cache table. But a call to variable_get() still returns the original value.

I thought that the variables were cached in the cache table, so where could this original value be hiding?

EDIT: I waited a few minutes and tried again and it was OK. So the immediate problem is solved, but I would like to understand what happened. Is there another layer of caching? It seems there must be since it could not have gotten that value by querying either cache (empty) or variable (containing new value).


texts:
What I need to accomplish is adding a link to a node to field widgets (the node contains the formatted instructions to properly compile the field).
The goal is something like this:

"What is this?" is the link to a node, to be opened in a new tab or in a popup. In this example the field is a select, but it could be any type of field.

So far I've been able to add the node reference field in the field config form, using Third Party Settings:

function mymodule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if ($form_id === 'field_config_edit_form' && $form_state->getFormObject()->getEntity()->get('entity_type') == 'myentity') {

    $field = $form_state->getFormObject()->getEntity();
    $help_page_id = $field->getThirdPartySetting('mymodule', 'help_page_id');

    $form['help_page_id'] = array(
      '#type' => 'entity_autocomplete',
      '#title' => t('Help page'),
      '#target_type' => 'node',
      '#selection_handler' => 'default',
      '#selection_settings' => array(
        'target_bundles' => array('help_page'),
      ),
      '#default_value' => $help_page_id ? Node::load($help_page_id) : NULL,
      '#weight' => 100,
    );

    $form['#entity_builders'][] = 'mymodule_form_field_config_edit_form_builder';
  }
}

Now I'm having troubles retrieving this information when showing the form, and altering the field widget in order to display the link.
Using hook_field_widget_form_alter, I cannot get the custom configuration value from the arguments I have:

function mymodule_field_widget_form_alter(&$element, \Drupal\Core\Form\FormStateInterface $form_state, $context) {

}

I guess I have to load the field configuration entity, but I don't know how.


texts:
I want to display webform submitted data in a view. How to recover submissions of my webform in a list?

I think that I can use hook_views_query_alter to change my view's query.

If that's right, how can I implement it?

Any idea please? Thank you!


texts: In an Organic Groups group, what permissions should be required to create content?

texts:
If I create an Organic Groups group node, MyGroup (nid=1234), and a content type, "Posts", that is set up for use as group content, what should the necessary permissions be to allow, for example, an anonymous user to create a Posts node in the MyGroup group?

I have seen writeups that imply all permutations of permission combinations, and also theoretically-fixed bug reports that imply things without any general rule in writing.

I know what appears to be current reality, as of 2.7 anyway, which is that I have to give the Drupal role "Anonymous" the permission "Posts: Create new content", and then also give the OG membership type "non-member" the permission "Create Posts content".

If I only specify the OG permission, the user gets an Access Denied error trying to load the /node/add/posts?og_group_ref=1234 form. If I only specify the Drupal role permission, the user has no problem loading that form and creating a node - but the node will not be in the MyGroup group. The only way to prevent the node creation is to make the group audience field (og_group_ref) required and hidden, so that if the prepopulated value from the URL isn't accepted, the field has no value, and so fails the required-field test.

Is this how it is supposed to work?


texts: Create a new revisions only at the time of specific state transition

texts:
I am using Revisioning and Workflow module along with Drupal 6 to create new states of the node and revisions.Currently if I select 'New revision in draft, pending moderation (requires "Create new revision")' under workflow settings it will create a new revision only when a node is published.But I want it other way.I want to create a new revision only at aspecific state change of my choice.

For e.g. The node is in 'Finally Submitted' state and it is transitioned to 'Moderation' state. At this transition I want to a new revision to be created otherwise not.

How is that achievable?


texts:
As most of you probably know when themeing in Wordpress you can use Starkers as your base theme. This clears up the view to show pure semantics so you can style and theme cleanly.

Is there an equivalent for Drupal?


texts:
I have a content management site where users can pay to view a node for a certain content type. To make it happen, I am thinking to leverage rules: when the user purchases a node to read, his access to this node is granted by the rule.

I have been searching around for a few days but didn't make much progress. I installed module ACL, but unable to configure it in rules; I also have Node Access Control, but also was unable to move forward with it. Currently, I have UC installed as my eCommerce platform and I am on Drupal 7.

Need advice from experts like you.

Thank you!!!


texts:
I have a form in my module that uses an ajax callback to replace input fields.

It's working on themes that come with drupal. However on a custom theme, it's glitchy. The replace happens, however the changes aren't displayed until i hit submit and the validation errors are triggered.

I'm really not sure why this happens.

If anybody has any idea why this happens, please let me know.

This is the theme i have issues with

http://drupar.com/theme/hertzpro


texts: PHP error in the log after PHP and Drupal upgrade

texts:
I got this error message in the log but not sure what is it about and how to fix it.  Has anyone seen the same issue before and know how to fix it?  Thank you so much!

  Drupal\Core\Entity\EntityMalformedException: The "view" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\EntityBase->toUrl() (line 192 of /var/www/drupal_dev_8.8.6/core/lib/Drupal/Core/Entity/EntityBase.php)


texts: Is it possible to add custom entries to the language switcher pointing to the same language?

texts:
I have a requirement to include Colombia, Peru and Mexico as part of the language switcher. Thing is these 3 countries all speak Spanish so is there a way to cater for this to include them in the language switcher? technically these three languages would have to point to the same spanish sub-domain

Thanks


texts: How to hide body field in a view only on certain content types

texts:
I have a search result view of different content types, and i want to show the body field (trimmed) on some content types, but show no body on other content types. Since they all share the same body field, I would need to exclude the body field from displaying on the content types that I don't want to see them on.

Right now I am doing this with Views rewrite results and CSS. I add the content type field and exclude, then add the body field. Under rewrite results I rewrite the output of the body field with this:

[body]

I then hide the content type bodies that I don't want to see with CSS:

span.search-body-MY-TYPE1,
span.search-body-MY-TYPE2 {
  display: none;
}

This works "visually", but the class and the trimmed body are still rendered in the HTML. Is there a better way to do this perhaps with a views_pre_render hook?

(I am completely inexperienced with PHP.)


texts: How would I change the label of a field in hook_form_FORM_ID_alter()?

texts:
For a Drupal 7 site, I'm trying to alter a form into multi-step and want to change the label of a field based on some answer from the first step, which is the reason for my question.

I tried modifying $form[$field_name]['und']['#title'] but the label gets set back to default sometime after the alter function.  I tried using an after_build function, but maybe I'm using it wrong because it still doesn't change.

Edit: The answer on Why is hook_form_alter() so messy? explains which label I should change.


texts: How to pass a url as a hook menu argument

texts:
I need to send a url as a variable in path e.g.

2 arguments. The 2nd argument would need to be a url so http://www.blah.com. However, at the moment even if I use urlencode (which produces /http%3A%2F%2Fwww.blah.com) on the url when I visit that url, it reads it as

http://www.foo.com/arg1/http://www.blah.com which it obviously cant find as a page

 $items = array();
  $items['json/%/%'] = array(
    'title' => 'JSON Nodes',
    'type' => MENU_CALLBACK,
    'page arguments' => array(1,2),
    'page callback' => 'json_feed_page',
    'access callback' => TRUE
    //'file' =>
  );
  return $items;


texts: How to update clientside validation rules in real time

texts:
I have a form in which a user can select the type of text input field that they would like to use (based on the available text input type fields that the clientside validation model supports - let's call this textfield A). Also on that page is another textfield (B) that permits a user to enter a default answer to be display in textfield A.

The problem I am having is that when the textfield type is select (say numeric values only), I would like the textfield B implement the selected validation rule and verify that the text in that field is indeed all numeric. Likewise if I change type to email that textfield B's validation rule updates and checks that the enter text conforms to the new rule.

Currently what I have set up is that when a text input type is selected an new textfield B is created with the new validation rule and the text (if entered) from the previous textfield entered as the default answer (this is done through AJAX calls and a custom module). The problem is that when the answer is validated, it is still using the original validation rule (regardless of how many times I select a different validation rule). It almost seems like the clientside javascript never gets updated. I am wondering if anyone has experienced this before and how one would go about fixing it?

Thanks.

PS I am using Drupal 7 and clientside validation module (both latest versions).


texts:
I need to add an image to the RSS feed. So I create a new row plugin for the RSS and it extends RssFields row plugin.

/**
 * Renders an RSS item based on fields.
 *
 * @ViewsRow(
 *   id = "image_field_rss_fields",
 *   title = @Translation("Fields with image field"),
 *   help = @Translation("Display fields as RSS items with an image item."),
 *   theme = "views_view_row_rss",
 *   display_types = {"feed"}
 * )
 */
class ImageFieldForRssFields extends RssFields {

I can select it in the format settings.

And it seems that works perfectly when I update the preview, I can see a new field image on every item of the RSS. But when the RSS feed is rendered, it uses the RssFields plugin instead of the ImageFieldForRssFields plugin that is setted.

I debugged it and it seems that always renders the RssFields plugin even if I delete the RssFields plugin, the view tries to locate it.

Am I missing something? How do I have to do to render the correct plugin?


texts:
I need to have layout like this:
[search box]
[facet - taxonomy 1]
[facet - taxonomy 2]
[search results]

But there is no block for the search box itself and no block only for the results.  Or can I somehow manipulate it in the template? I'd rather not use JS to move the components around.


texts: Admin file upload assigned to specific users

texts:
I'm looking for a way to allow the administrator to upload files. These files will be for specific site users (think receipts, test scores, etc) and can only be viewed by that specific user.

Things i've tried:

Groups - creating a group for every user is a no go
Nodeaccess - doesn't work properly in D8

Site is running latest version of Drupal 8.

Any modules or direction will be helpful.


texts: Adding comments to a node via drush or commandline

texts: I'm trying to set up a server documentation system using drupal 7. Each server would have it's own page/ node. Updates or changes made to the system would be noted as comments on the servers page. What I'm looking to do is to be able to add a comment via drush or some other command line tool so that I can create an alias on each server to add a comment to that servers page.  I'm not a programmer so any help would be appreciated.


texts: How to: Admin flags content, owners of content gets email nofication

texts:
I'm building a site where users of the role Contributor submits content (songs). Songs gets rated by users of the role Curator and the best rated Songs are added to Playlists by the Admin.

The Admin is presented with the best rated tracks in a Views table. I'd like to have a flag on each Song with these values:

Playlist add confirmed
Playlist add pending (default mode)

When admin flags the Song with the 'Playlist add confirmed' mode this should fire an email (via rules?) to the Contributor who submitted the Song in mention notifying the Contributor of the good news.

The admin table of best rated tracks are ready and working but I'm stuck at getting the Flags and email notifications working.

How would you do this?


texts: Problem in drush configuration with wamp server 64 bit

texts:
I am trying to enable drush for wamp server 64 bit.

I have configured all things with youtube videos and it seems it must be ok but when I run drush via cmd console, I see this error message :

PHP Warning:  PHP Startup: Unable to load dynamic library './php_gd2.dll' - The
specified module could not be found.

My operating system is windows 7 64 bit. so I have installed Wamp server 64 bit version. PHP version is 5.5.12 and apache version is 2.4.9

I don't know what is the reason of this problem. I checked my php.ini
extension path is ok. also I can see "php_gd2.dll" file inside extension folder.

so why I see this error that says specified module could not be found?


texts: How do I add multiple custom CSS classes to Views rows?

texts:
This is a kind of follow up to this question:

I have a view where I added taxonomy tags as custom CSS class for rows of a unformatted list:

I did that using Replacement Pattern [tags] as row class.

The problem is that I need to filter by tags and so every taxonomy tag should be added as a separate class. I would need spaces instead of - so the output would be something like that:

Is this possible with Views GUI or do I have to use Views preprocess function?


texts: How to add a background image wallpaper to a drupal site from within the drupal admin?

texts:
How can I add a background image wallpaper to a drupal site from within the drupal admin i.e. not editing themes or PHP?

I'm not adverse to PHP or themes but adding a background image wallpaper is a generic non-theme specific feature so should require editing a specific theme.

This has to be one of the simplest/fundamental/popular things one wants to do with their site. It ought to be obvious in Drupal -and- possible within the Drupal admin, not via editing themes / PHP code.

Is there a way to do it?

I found some promising modules (actively depveloped for Drupal 7) but am a little unsure how to use them:

http://drupal.org/project/bg_image (Instructions say: "provide a css selector and color and repeat attributes in the 'Default CSS Settings' section." - but how do I know what CSS selector to use? Yes I know CSS but in the context of Drupal, is there more than one I need to consider and why? Perhaps an example would help here)
http://drupal.org/project/dynamic_background (This has more advanced settings for specific entities in drupal: User, Blog, Panels, Node, Views (beta), Context) - OK fine. BUT WHICH one do I use to simply put up a background image for the pages of my Drupal site?!


texts:
I want to send a message to users that have commented on a node each time a new comment is left.

I think I am half way there.

I have created a component of the content type, added a loop that looks at the “node:comments” and set the email up using referenced mail list

I have also created a rule that triggers the component on the event of a new comment.

The problem I have is that I want to exclude the node author as they get notified anyway when a new comment is left in a separate rule.

Also, that if you have left more than 1 comment on the node you get more than 1 email so I need to filter it down.

I am fairly new so as much detail as possible would be appricatied.

Many thanks :-)

David


texts: Cron job in custom module not appearing in Cron Settings (using Elysia Cron)

texts:
Very strange problem that I cannot find anyone else having. I have a custom module and am using hook_cron(), but the cron job is not appearing in /admin/config/system/cron of my Drupal 7 site.  All the other cron jobs I created through custom modules are there, and I did not think I did anything different.

Here is my function, in a file called file_handler.module

function file_handler_cron() {
   $log_file = '/www/anon_site.org/htdocs/sites/all/modules/custom/file_handler/log.txt';
   $log_file_size = exec("du -h $log_file", $output, $return_size);
   $size = substr($log_file_size, 0, strpos($log_file_size, '  '));
   $measure = substr($size, -1);   //K, M, G, etc.
   $num = str_replace($measure, '', $size);  //4.0

   if ($measure == 'G' || $measure == 'T') {
       file_unmanaged_delete($path);
   }
   elseif ($measure == 'M' && $num > 10) {
       file_unmanaged_delete($path);
   }
   else {
       //log is small and does not need to be deleted
   }
}


texts: Override front page to not display promoted article

texts: Is it possible to override front page template to not display the promoted articles? I am using the promote to front page option to filter the contents in a  view so I cannot uncheck it.


texts:
I am using WYSIWYG with CK editor library. The problem is its showing blank toolbar by default on WYSIWYG editor on node add/edit page. To make the buttons appear on the WYSIWYG toolbar I always have to goto admin/config/content/wysiwyg/profile/full_html/edit

and have to select which buttons to appear on the WYSIWYG editor toolbar.

Is there a way we can select all check boxes at once


texts: How to display data in tables using Forms API?

texts:
I want to organize my data in table rows. How can I user Forms API to do it?

EDIT:

I want to show the data in the following way in multiple rows:

row1 checkbox info1 textfield1 info2 textfield2 ....

....

rowN ....

row 1 [add a new row fields here]

...

row 5

One should be able to cancel existing records and in the bottom fill in fields to add new records.

And I finding the solutions  in this link  or in this really difficult to understand.


texts: How to add two "add more" buttons in CCK form?

texts:
I am using cck 3.0 with multi group fields, basically multigroup provides one add more button for all fields inside multigroup fields.

I am trying to add two "add more" buttons in multigroup fields:

one button is for generic purpose and one for specific prupose.
For example:
I have 4 text fields in a compound form, and I have two button with names 1. "add more items" and 2. "add less fields".

If I click on "add more items repeat all fields", but if I click on "add more less fields button" repeat all field but display only first 3 fields and the forth one is by default display none. How can I do this?

I am using Drupal 6.


texts: Use title attribute of image field in rule

texts:
I like to use the title value of a image field in a rule. The provided tokens for the image field do not contain title or alt attribute. I have only tokens for file:fid, file:name, file:mime, file:size, file:url, file:owner:..., file:type but nothing like file:title or file:alt.

I already had a look for a module providing title / alt value of image field as token but wasn't successful. I can't imagine I'm the first one who like to use title attribute in a rule. Is there any way to achieve this?


texts: How to add a custom widget to a node creation form Drupal 6

texts:
This may be a dumb question, but nothing I could find really told me what I was looking for. Without furthur ado:
I need to add a custom widget that will edit node reference fields on CCK content types. This widget needs to show up in the node creation form, and should consist of a textbox and a button. When the button is clicked, the widget should take the contents of the textbox and use it to create a new node of a different content type and then store a reference in the field it edits.
I need the D6 hooks which I need to implement this. Links to their documentation would be helpful.


texts:
I have installed drush on crunchbang linux and while most of the drush commands are working, I can't get core-cli to work.  Typing drush @dev core-cli produces:

  The drush command 'core-cli' could not be found.  Run[error] drush
  cache-clear drush to clear the commandfile cache if you have
  installed new extensions.

I initially tried installing drush via apt-get, but when core-cli didn't work I tried getting it via pear, but it's doing the same thing.  With the version I got from pear - which is 5.8 - the command drush self-update works, where it didn't in the apt-get version, which was an earlier release.

I've made sure that my user has full rights to the /usr/share/php/drush folder.

Please let me know if you have any suggestions on getting core-cli to work on crunchbang (debian).


texts: How to get constant string array field into db_query?

texts:
First post here :)

Here's a valid MySQL query: SELECT "'a','b'" AS FieldStrArray;

(To enter as a string in PHP, remember the backslashes before double quotes.)

At least in Drupal 7's db_query(), this produces a fatal PDO exception, complaining that 'a','b' is not a known field.

My question: how do I work around this apparent limitation of db_query()/PDO?

(Yes, I need a constant string array as one of the field results. This is a minimal replication of the problem... :) )

Any suggestions MOST welcome... including a) whether this is also a problem in PHP itself, b) how to report this as a bug to the Appropriate Authorities, c) Any creative ideas for a workaround assuming it is a real bug.

Thanks!


texts: How to display rss from external site into a view and sort them?

texts:
I want to import RSS from an external website and then display them in a view content pane. I also have to sort them by date. The External RSS contains Title, Body and Date but the Date is hidden by default in RSS, I guess. I checked the Aggregator and feeds module but I don't think it serves the purpose because i also have to link the title to the Nodes on the External site.
Thank you.


texts: Why responsive panels are not one beside another by default?

texts:
I am using the adaptive theme with panels, mini panels, panels everywhere, and AT Panels Everywhere. My site default template is of at panels everywhere.

I built a 5 column mini panel for the footer. I assigned for each column only one thing: menu, or a logo, or "powered by drupal".

When I am using the builder layout for the mini panel, and build 5 column - every thing works fine, and I have 5 column one beside another, in only one row. (although, I am trying to avoid the builder and use only AT layouts).

But, If I am using the "AT responsive panel - 4,5,6 column" for the mini panel layout, the result is that my footer has two rows: top row is with 2 panels and bottom row is with 3 panels. it  looks like the blocks or something are too big, and the AT layout is just being responsive.

I tried to solve that and make it one row, and add to each panel a class, and made them very narrow. but that didn't work, and I still have 2 rows, even though the panels are very narrow and can feat perfectly in one row (5 columns).

How can I make sure that every panel will use 20% of it's layout (when possible), and all will be presented in one row, 5 columns side by side?

Here is the problem:

Here is the footer code:

The footer is still in two rows, and looks like that:

What causing the AT mini panel to think it has no room, and need to change the layout?


texts: How to generate different image styles at upload?

texts:
I'm using Drupal 8.
Is there a hook for generating image from image style or better one module?

For example. I upload an image. When image is displayed for the first time, Drupal generates image style. Can I hook to that event somehow, at best when uploading the image?


texts: Getting An AJAX http error occured when updating modules

texts:
I recently staring getting a

  "An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: http://192.168.1.20/alan_page/authorize.php?batch=1&id=67&op=do StatusText: Internal Server Error ResponseText:" whenever I try to update modules after downloading them.

My Apache logs(last 4 lines after attempting updates read):

  [Mon Dec 21 17:14:35.456511 2015] [:error] [pid 2025] [client 192.168.1.10:50056] PHP  96. FileTransferFTPExtension->chmodJailed() /var/www/drupal/includes/filetransfer/ftp.inc:134, referer: http://192.168.1.20/alan_page/authorize.php?batch=1&op=start&id=67
  [Mon Dec 21 17:14:35.456529 2015] [:error] [pid 2025] [client 192.168.1.10:50056] PHP  97. FileTransferFTPExtension->chmodJailed() /var/www/drupal/includes/filetransfer/ftp.inc:134, referer: 192.168.1.20/alan_page/authorize.php?batch=1&op=start&id=67
  [Mon Dec 21 17:14:35.456547 2015] [:error] [pid 2025] [client 192.168.1.10:50056] PHP  98. FileTransferFTPExtension->chmodJailed() /var/www/drupal/includes/filetransfer/ftp.inc:134, referer: 192.168.1.20/alan_page/authorize.php?batch=1&op=start&id=67
  [Mon Dec 21 17:14:35.456565 2015] [:error] [pid 2025] [client 192.168.1.10:50056] PHP  99. FileTransferFTPExtension->isDirectory() /var/www/drupal/includes/filetransfer/ftp.inc:127, referer: 192.168.1.20/alan_page/authorize.php?batch=1&op=start&id=67

Does anyone have any clues on what might be the problem?


texts: Recoverable fatal error when trying to run hook_query_TAG_alter()

texts:
I used the approach provided here to reverse comments order in Drupal 8:

    /** Implements hook_query_TAG_alter().
 *
 * Alter comments query to order by DESC as well as the default ASC.
 */
function MYMODULENAME_query_comment_filter_alter(QueryAlterableInterface $query) {
  $orderby = &$query->getOrderBy();

  // Sorting for threaded comments.
  if (isset($orderby['torder'])) {
    // Sort by root parent first, then normal threaded.
    $query->addExpression("SUBSTRING_INDEX(c.thread, '.', 1)", 'rparent');
    $orderby = array('rparent' => 'DESC') + $orderby;
  }
  // Sorting for flat comments.
  else if (isset($orderby['c.cid'])) {
    $direction = 'DESC';

    $orderby['c.cid'] = $direction;
    $orderby = array('c.created' => $direction) + $orderby;
  }
}

but I receive the followig error when run the module:

  Recoverable fatal error: Argument 1 passed to
  mymd_query_comment_filter_alter() must be an instance of
  QueryAlterableInterface, instance of
  Drupal\Core\Database\Query\PagerSelectExtender given, called in
  D:\wamp95\www\drupal83\core\lib\Drupal\Core\Extension\ModuleHandler.php
  on line 501 and defined in mymd_query_comment_filter_alter()

what is the problem and how should I solve it?


texts: How to trigger a rule if a node has a certain Taxonomy term?

texts:
I'm trying to create a rule using Rules that will apply a watermark to an image within a node (using the ImageCache Actions module) if that given node has a specific Taxonomy term. For example, nodes with the term "Video" will get a play button icon over their image.

Is there a way to add taxonomy terms as a condition in Rules? It seems like it would be a simple task but I can't seem to figure it out. Does anyone know how I could do this?


texts: how to update FieldStorageDefinition in a hook update?

texts:
This is a feeds module related issue. An entity update that  started to cause errors on 8.7.x after the removal of automatic entity update. Originally an entity definition needed to be updated using entup but was not. And after upgrading to 8.7 this started to cause fatal errors. So now I have to force update it:

In summary:

$field_storage_definition = $entity_definition_update_manager->getFieldStorageDefinition('config', 'feeds_feed');

returns an object:

Drupal\Core\Field\BaseFieldDefinition Object
(
    [type:protected] => feeds_serialized
....

I need to update this object so [type:protected] => map instead.

For what's it's worth, it is also possible to uninstall the module and re-install it but I am now just curious on how to update this object in a hook_update.


texts:
I have a dilemma.

For my articles content type, i'm wondering how to alter a url automatically if i need to replace the hyperlink of my image thumbnails residing on my site to link to my other site which is my data repository on another server. Apart from doing it manually, i would like to know if i could automate this and create a script to do it, but i'm also not sure where to put it.

regards,
V


texts:
How do I restrict access to the route by current user in Drupal 8?

I want to create a new tab in user profile path: '/user/{user}/my-cool-tab', which should be accessible by current user only. For example:

path /user/5/my-cool-tab should be available only for UID=5
path /user/7/my-cool-tab should be available only for UID=7
etc.

Which way is the simplest and correct for that?


texts: Duplicate rows when getting list of latest revisions of a content type

texts:
I want to create a list of latest revisions of a content type, in a specific moderation state to use in a custom dashboard.

It needs to have the following fields listed in a table form.

Content Title
Language
Node ID
Content Type

Here is what I tried
1. Created a view with Content Revisions
2. Filter with Latest revisions
(Everything works fine upto here)
3. Since I want to include content type, its not available in revisions, I added a Content revision.
(There appears a lot of duplicated rows)

How to tackle this? I tried adding aggregation with minimal success.


texts: I know I can load a favicon though the user interface, but is there a way of setting the default favicon for your theme, so that when someone enables the theme, the default icon is immediately used?


texts: Set the inital number of empty values for a cck multi-value field

texts:
I have CCK fields that can hold multiple values, I would like some of them to default to showing say 5 values initially.

I'm not looking for any validation that all 5 values are used however.

Thanks!


texts:
I have a project that allows people to add 'skills' and 'resources' to a system. Initially I was using a taxonomy field for the objects themselves because it seemed to make it easy to look up other 'skills' and 'resources' that had already been added to the system.

However, I am beginning to wonder whether this is the best plan.
The taxonomy system allows for a 'library' of objects to be created which can be shared but this isn't the right way to use taxonomy which should be for 'meta-information'.

I could have a preexisting taxonomy structure of 'stuff' like ebay's categorie and allow people to add their own stuff to this library. People would add 'skills' and 'resources' as their own content types with additional fields- title, body, image, and then tag them within this taxnonomy structure. However, I was attracted to the idea of keeping it really simple; e.g. a drill is only a drill not a bosch, 12v battery powered handheld drill with hammer setting and masonry bit :)

If I wanted to have a 'drill' categories with a pool of 'drills' with more specific drill information what would be the best way to do that?

Sorry there are a few questions here, but I'm hoping to put together question an exciting distribution from this project, so any thoughts will help and hopefully go to something worthwhile.


texts: Multilingual Paragraphs fields are not present in node content

texts:
Following these Instructions I set up a paragraph field in custom node type. The field is called field_content_sections and it holds the paragraph elements. Next to it I created another field, the plain old list field called field_content_rating_level.

But when i create a node of that type with filled out parapgraph elements, the paragraph field doesn't appear in the nodes content, but the plain old list field does:

What I've done wrong?

I tried it with Drupal 8.5.6 and 8.6.0 and the most recent versions of the paragraphs module itself.


texts: Create URL encoded taxonomy term name in views field

texts:
I have a view of taxonomy terms where I need to overwrite the output of a couple fields to be Solr search URLs, and part of the URL is the url encoded term name. So, for instance, if my term name is Agriculture & Forestry, I need it to be encoded to Agriculture+%26+Forestry. My initial approach was to use the Output this field as a custom link setting under Rewrite Results in the field settings by inserting the {{ name }} in the URL, but that's obviously not encoded, so I would have to use a prerender or preprocess function to encode a string that is part of a long URL (not exactly efficient).
What would be a better way to do this? My next thought is something I've done before, which is override a field plugin, but that might be a bit of overkill.
UPDATE: I'm trying to use hook_views_pre_render() like so:
function mymodule_views_pre_render(ViewExecutable $view) {
  if ($view->id() == 'product_browser' && in_array($view->current_display, ['category_page', 'market_page_2' ])) {
    $url_1 = '/search?f%5B0%5D=markets%3A';
    $url_2 = '&f%5B1%5D=toggle_search_facet%3Ageneric_product&f%5B2%5D=toggle_search_facet%3Aproduct_group';
    foreach($view->result as $value) {
      $term_name = urlencode($value->_entity->label());
      $search_url = $url_1 . $term_name . $url_2;
      // How to set result value?
      $value->_entity->set('', $search_url);
    }
  }
}

I'm to to the part where I want to save the created value, but I can't figure out how. $value is a ResultRow instance which doesn't inherit from any parent class, and $value->_entity is a Term object, but I want to update the view. result, not the Term object itself. so I'm not sure what to use to set the value. In other places, I've seen to use $value->_entity->set(), but that's not a valid method here.


texts: Way to see the date roles were assigned?

texts:
Is there a way to setup a view in drupal 6 that shows me users assigned new roles in the last month and who assigned the role?

I have video products that sell both through the online store and at the front desk of various martial arts schools. Currently the online portion is handled with ubercart granting access to appropriate roles. However tracking the sales from the front desk is messy, using the role watchdog module and filtering the email notifications.

Being able to see all role modifications in the last month would simplify tracking of sales to each school greatly.


texts: How to migrate Ubercart Shop (drupal 6) to another CMS / Shop system as Commerce, Magento, etc?

texts:
How to migrate Ubercart Shop (drupal 6) to another CMS / Shop system as Commerce, Magento, etc...

Is there any easy way to migrate a Drupal 6 Ubercart store to another CMS or shop system?

What would you use instead of Drupal Ubercart?


texts: Configuration settings in filedepot for folders

texts:
How to setup permissions in filedepot module?

I have 2 users like A and B.

User "A" can create the folders and he can upload the files into that folders, but folders and files should not show or share to user "B". User "B" be follow the same functionality.

Only user can view the owned files.


texts: How to move the Forena report parameters block further down and give it a separate heading?

texts:
Can the Forena parameters block be moved further down and given a separate heading?

The Forena Parameters block sits at the top of the page, but I would rather have it further down the page after some report headers, and with a different title like Conditions or Settings.
I would also prefer it to be opened rather than collapsed the first time the report is opened.
Is there some way to set this, preferably without editing the code for the module?


texts: Page template suggestion based on content types but not for node/edit or node/delete

texts:
I have a template for a page content type that works perfect. But when I try to edit or delete the node of that content type it blocks the standard template.

So node/130/edit? or node/130/delete? are not working because I don't get the right page.

I tried strpos($_SERVER['REQUEST_URI']) versions but it doesn't work or like the one below only gives me the "original" Drupal template  when the path is node/130/edit? so the second variable gets through.

function mytheme_theme_suggestions_page_alter(array &$suggestions, array $variables) {
      // Add content type suggestions.
      if (($node = \Drupal::request()->attributes->get('node')) &&
      (strpos($_SERVER['REQUEST_URI'], "delete") || strpos($_SERVER['REQUEST_URI'], "edit") === false)
      ) {
        array_splice($suggestions, 1, 0, 'page__node__' . $node->getType());
      }
    }

The array_splice hint comes from
https://www.drupal.org/forum/support/theme-development/2015-07-02/how-to-add-in-drupal-8-a-custom-suggestion-page-template#comment-10684366

Any help?


texts: How to combine values of same field in a single column of a chart created with Charts?

texts:
My question is about merging values for both the title field (= the company name) and various fields. I'm currently using the Charts module.

In the picture below, it shows a column chart that displays a content type with a field of title, integer field (labeled 2017), and another integer field (labeled 2018). In this view, I have a chart (showing title and 2017) and a chart add-on (title and 2018).

The graph looks like this:

Here is how the table about these data looks like:

  Company   ! 2017 ! 2018
  ----------+------+-----
  Company A ! 5    ! 6
  Company B ! 2    ! 3

What I want to do is SUM all the values of the 2017 field into one column and values of 2018 into one column.

I tried using the Views Merge Rows module and configured the option to SUM all the values of 2017 and 2018 into one column, but it's not working for me. The chart (showing title and 2017) works since it combines all values, but the chart add-on splits apart and I don't know why.

This is what I get:

Is there a way to combine all values of 2017 and 2018 into one column for each year? "Combine" means that I want to sum all values from a field into one column, so  for (e.g.) 2017, it should be 7 (=5+2).

Note: I'd prefer to not Use the Charts API, but I will if I have to.


texts: Profile 2, update separate database on submit?

texts:
I want to know where and how to plug/hook into profile 2, so that when the user updates a specific profile ("new_profile"), that this then fires off a chunk of custom php code. The event must only be fired off IF validation passes. Which leads me to believe that I can't really just add another submit handler.

How would I be able to fire off this "second update" to a seperate database, if I only want to hook into the part after validation has passed?


texts: Infinit loop when I submit a form and redirect to this form with an additionnal parameter

texts:
I created a form. When the form is submitted, I want redirect to the form page and pass an additional parameter.

I do this :

public function buildForm(array $form, FormStateInterface $form_state, $results = null)
{
  if ($results) {
    customlog($results, "RESULTS !!!"); // write in a log file
  }
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => t('Submit'),
  ];
  return $form;
}

public function validateForm(array &$form, FormStateInterface $form_state){}

public function submitForm(array &$form, FormStateInterface $form_state) {
  $results = array();
  // do some work ...
  // ...
  // $results is a simple associative array
  customlog("I pass here !", __FUNCTION__); // write in a log file
  return \Drupal::formBuilder()->getForm('Drupal\mycustommodule\Form\MyCustomForm', $results);
}

My issue is when I submit this form, the page indefinitely load. When I check my log file, I realize that the "I pass here !" log is repeated indefinitely.

Where is my mistake ? When the form is submitted, how can I redirect to the same form with an additional parameter without this infinit loop ?

Thank you :)


texts: how to pull data from view to file and attach to email

texts:
I have a particular use case where I want to be able to convert an existing list of Flags into a file and attach this to an email sent to the admin and user.

I currently have a working Flags list set up. What I would like to do is to covert this view to a file and be able to email it to my user and myself (admin) on the forms submission.

I envision implementing this through 1) creating the Flag list 2) converting to file 3) emailing this as an attachment to an email through the webform.

I've found modules that deal with data export, but I need some guidance on how to implement this. I suspect I may have to build my own module, but I'm only starting to dive into how to do this. Any advice on where to jump off would be greatly appreciated.

I imagine this will take the following steps: 1) check that flag list is populated 2) if flag list is populated write it to file 3) upon form submit, email a copy to user/admin


texts: Where are the field variables in a block template?

texts: How can I access the variables of the fields in a block template?


texts: Give permission to non-admin user to view and edit list of orders

texts:
I am trying to create a role and assign it to a user who can view the admin orders list page and also edit the orders.

After adding all the permissions under the order sections in the permissions page, I was not able to access the list of the orders but was able to see the orders separately and edit them using the order number.

admin/commerce/orders page was accessible but the list was not showing.

Why is this happening? Is there any way fix this?
From the screenshot, you can see that I have given all the required permissions with respect to orders.

Any help is much appreciated.


texts:
I'm creating a dummy website to learn Drupal 7.
The idea is to build a car garage.

I added "Cars" as a vocabulary in Taxonomy.
Under Cars I made a list of terms (and sub-terms):

Cars

BMW

1 serie

1.18D
1.20D

3 serie

3.30D
3.35D

5 serie

Mercedes

A-Class
C-Class

Audi

...

I used Taxonomy Menu module to display my Vocabulary as a menu item in my main navigation. But now I want my children (terms) to be shown on this page... And when I click on a specific term, I would like it to show this page's child-terms...

I also installed Views module, made a view that would filter like this: Taxonomy vocabulary: Machine name (= Cars), but it's showing everything within my vocabulary...

I searched a lot, maybe not using the right keywords... (new to Drupal).
I hope somebody can help me on my way...


texts: How to attach a library to a page controller that returns a plain Symfony response?

texts:
I created a custom module with a page controller that returns a Symfony response (Symfony\Component\HttpFoundation\Response). The thing is I don't want to render my custom theme in this controller, just the theme_base template in this module.

$build = array(
  'page' => array(
    '#theme' => 'theme_base',
    '#content' => $content,
    '#owner' => $owner,
    '#cache' => [
      'max-age' => 0,
    ],
    '#attached' => array(
      'library' => array(
        'my_module/library_name',
      ),
    ),
  ),
);

$html = \Drupal::service('renderer')->renderRoot($build);
$response = new Response();
$response->setContent($html);

return $response;

I tried attaching the module library to $build, or including it directly in Twig template but this doesn't seem to work.

Any ideas why this is not working? Or is there maybe another way I could do this?

Thanks!


texts: Filtering a View that is output as a Block

texts:
I have a view which has a page display and a block display. The block display has Use Ajax enabled so the filters show up. When I output the block display to my template using:

<?php print views_embed_view('list_disciplines', 'block_1'); ?>

It outputs correctly, and shows the filters. The problem is when I submit the filters form it redirects me to the path I have set up for the page display, and doesn't use ajax at all.

Any ideas?


texts: How to check if a library is present during installation?

texts:
How can I check if the library, which is required by my module, is present while the module is getting installed?

I have used hook_requirements with the libraries_detect function with REQUIREMENT_ERROR severity. This restricts the module from getting installed irrespective of the library is present of not.

Here is my code:

function hook_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'install') {
    if (function_exists("libraries_detect") && !libraries_detect('external-lib-api')) {
      $requirements['library_api'] = array(
        'severity' => REQUIREMENT_ERROR,
        'description' => $t(
          'The required Libarary is not installed.'
        )
      );
    }
  }

  return $requirements;
}

Am I doing something wrong in this? Is there any other way of doing it?


texts:
I'm trying to filter content based on user data.

I've created taxonomy and made the "link" between my user and my element. For this part, it's working.

Taxonomy is "Privilege" which contains "Gold" and "Silver"

User also contains this taxonomy.

In my first view, I have some filter (if article and user are premium, show article), this is working.

Now, I want to show all articles which have 0 Privilege (but the user can have one).

In my second view (I've added an Attachment to the first view), I can display all articles, but this is showing all articles, including filtered articles from my first view.

How to add a filter where taxonomy of article is different from user taxonomy ?

EDIT : I've made some changes. I've created another privilege called "nothing". If "nothing" is set, show the content.

I have my first page, which list all content filtered by user data, and I've added an attachment which list all content where privilege = "nothing".

How can I do to "merge" page and attachment ? It only add a option "add before/after page". This is working, but I want to add the result of the attachment to the pagination of the page.


texts: Using ColorBox to popup "iFrame" shows original page content after the "iFrame" data?

texts:
I have a basic module that parses a JSON feed, stores it in cache, then shows a "gallery" of the objects - I know I should have maybe stored these as Nodes but it was supposed to be a quick simple module...

Anyway, it works well except, when I click on one of the objects in the gallery, I have it linked to an "iFrame" (which I cached too, but it's not really a real page) found at:
the_page?iFrame-id="theDataID" - these all popup in ColorBox and the HTML from the cache for the "iFrame" is displayed.

This worked well on the dev site, however for the production site - it uses different modules and templates (which I didn't have access to for setting up the dev site).

Now when you click on an object, the ColorBox popup shows the data, except it then shows the original pages' content and I haven't been able to figure out why it does that. I assume the prod site must try to always load the "original content" based on the URL and therefore "ignores" the ?iFrame-id part?

So basically, in my code for the iFrame, I do:

echo $data;
return;

Which causes the data to be printed above the normal pages' content in the popup. So I changed it to:

return $data;

But that caused the data to show up as the pages' content, and I still had the header/footer for Drupal.

Anyone have any ideas?

Another way I could do this is by using ColorBox's inline option instead of the iframe option, however I assume that would require all the data for the objects to be on the page? As right now, the content is loaded dynamically on popup (it doesn't exist anywhere in the DOM before hand).


texts: How Do I Disable CiviCRM locally if I don't need it?

texts:
I'm working on a Drupal 7 site build and I have a local development environment.  The site has CiviCRM working with it, but I'm not doing any work related to CiviCRM so I'd like to just have it disabled in my local environment.

Can I somehow set my civicrm.settings.php or other file to just have CiviCRM disabled (or pointing to a dummy civi install) when working locally?

I could disable the module, obviously, but this throws a bunch of errors on various places, so I guess ideally I want to 'fake out' CiviCRM with fake database or other information in settings.php, making everything just fail silently.


texts: Does field_revision_field_xxx table store the same values as field_data_field_xxx does?

texts:
I use drupal7.

According to the answer here,

{field_data_[field_name]} Standard data storage for a field.
{field_revision_[field_name]} Standard revision storage for a field.

I understand it, but, finally, they store the same values, right? This is because, I found that field_revision_field_xxx actually stores the updated values after I update a field-xxx.

[The reason why I ask this]
I try to transfer field values from one profile type to another which have the same uid. For it, I create field_data_field_xxx_transfered and field_revision_field_xxx_transfered and rewrite the pid in them.

I succeeded to transfer values from field_data_field_xxx to  field_data_field_xxx_transfered. And, if field_revision_field_xxx stores the same values as field_data_field_xxx does, all I need to do is to copy field_data_field_xxx_transfered to field_revision_field_xxx_transfered. And, this is much easier than to do from field_revision_field_xxx to field_revision_field_xxx_transfered.

Thank you.


texts: Download entire drupal contrib repository

texts: I would love to download (or, preferably, clone via git) the entire drupal contrib repository (6 for now, but 7 also). That way I can do cool stuff like search the repository via grep for hooks, examples, and implementations that I can reflect upon, improve, copy or steal. Is this possible? Is there a native way to do this via drupal.org or github.com/drupal? Do you have a current-ish copy of said repository. Please. Don't be greedy.


texts: How to convert query string http://example.com/myview?page=1 to http://example.com/myview/page/1 in views?

texts:
I have to make url of views seo friendly. I need to convert query string http://example.com/myview?page=1 to http://example.com/myview/page/1.

Can you please suggest, how can i do this.